启动时无法连接到本地的redis。
报错如下:
17:21:15.602 - INFO 13324 --- [ main] c.l.c.m.practice.user.UserApplication : No active profile set, falling back to default profiles: default 17:21:16.497 - INFO 13324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 17:21:16.500 - INFO 13324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode. 17:21:16.538 - INFO 13324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 18ms. Found 0 Redis repository interfaces. 17:21:16.901 - INFO 13324 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=42eceec7-dc88-3aeb-8bcb-2cba61f96a31 17:21:17.002 - INFO 13324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$5008bf33] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 17:21:17.309 - INFO 13324 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8061 (http) 17:21:17.340 - INFO 13324 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 17:21:17.340 - INFO 13324 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.30] 17:21:17.347 - INFO 13324 --- [ main] o.a.catalina.core.AprLifecycleListener : Loaded APR based Apache Tomcat Native library [1.2.24] using APR version [1.7.0]. 17:21:17.347 - INFO 13324 --- [ main] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 17:21:17.347 - INFO 13324 --- [ main] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 17:21:17.355 - INFO 13324 --- [ main] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1g 21 Apr 2020] 17:21:17.491 - INFO 13324 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 17:21:17.491 - INFO 13324 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1865 ms 17:21:18.661 - INFO 13324 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)] 17:21:18.671 - WARN 13324 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 17:21:18.671 - INFO 13324 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath. 17:21:18.675 - WARN 13324 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 17:21:18.676 - INFO 13324 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath. 17:21:18.845 - INFO 13324 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 17:21:19.413 - INFO 13324 --- [ main] io.lettuce.core.EpollProvider : Starting without optional epoll library 17:21:19.415 - INFO 13324 --- [ main] io.lettuce.core.KqueueProvider : Starting without optional kqueue library 17:21:21.115 - WARN 13324 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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 17:21:21.117 - INFO 13324 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 17:21:21.243 - INFO 13324 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] Process finished with exit code 1
我的电脑是Windows系统,没有装redis,连接不上,当注释掉有关redis的依赖后就不会报错了
想请问一下老师,这样的话怎么设置redis的地址?
43
收起
正在回答
1回答
同学你好
如果同学是在远程服务器上安装了redis ,
这里可以换成你服务器的地址即可,
如果都没有的话,建议同学先在本地安装一下redis哦。
祝学习愉快!
java工程师2020版
- 参与学习 人
- 提交作业 9393 份
- 解答问题 16556 个
综合就业常年第一,编程排行常年霸榜,无需脱产即可学习,北上广深月薪过万 无论你是未就业的学生还是想转行的在职人员,不需要基础,只要你有梦想,想高薪
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星