es模块没有使用redis 但是去启动的时候会报关于redis的错误

es模块没有使用redis 但是去启动的时候会报关于redis的错误

es模块没有使用redis 但是去启动的时候会报关于redis的错误 文件中增加了redis的配置 错误消失

ERROR SpringApplication Application run failed

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/boot/autoconfigure/session/RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:843)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)

at com.imooc.Application.main(Application.java:22)

Caused by: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379

at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1111)

at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1084)

at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:866)

at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:341)

at org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration$EnableRedisKeyspaceNotificationsInitializer.afterPropertiesSet(RedisHttpSessionConfiguration.java:302)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)

... 16 more

Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379

at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:78)

at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56)

at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:235)

at io.lettuce.core.RedisClient.connect(RedisClient.java:204)

at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:113)

at java.util.Optional.orElseGet(Optional.java:267)

at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:113)

at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1104)

... 22 more

Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:6379

at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)

at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327)

at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)

at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:670)

at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:582)

at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:536)

at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)

at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)

at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)

at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.net.ConnectException: Connection refused: no further information

... 12 more


Process finished with exit code 1


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
风间影月 2020-06-20 18:07:05

你的这个项目里依赖了redis,所以他默认你需要加载redis的配置。把redis配置加进去。
或者在application.java启动了,把redis的自动装配排除

  • 提问者 萝卜欺白菜 #1
    老师在application启动类中中如何移除
    2020-06-20 19:18:49
  • 提问者 萝卜欺白菜 #2
    我是在foodie-dev-search项目中,添加了es相关模块,也没有加入redis的东西
    2020-06-20 19:22:17
  • 风间影月 回复 提问者 萝卜欺白菜 #3
    Exclude autoredis... 代码补全一下
    2020-06-20 19:24:40
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师