Spring会话,嵌入式Redis服务器错误

时间:2015-03-31 09:35:18

标签: redis spring-session

无法启动嵌入式Redis服务器,其出现以下错误。可能是什么原因。我正在使用Ubuntu的Wildfly。以下是堆栈跟踪。

  

......还有25个   引起:org.springframework.beans.factory.BeanCreationException:创建名称为' redisServer'的bean时出错在org.egov.infra.config.session.RedisHttpSessionConfiguration中定义:调用init方法失败;嵌套异常是java.lang.RuntimeException:无法启动redis服务器。检查日志以获取详细信       在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)       在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)       在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)       at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:303)       在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)       在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)       在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)       在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:116)       at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)       在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)       在org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:139)       在org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:93)       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[rt.jar:1.8.0_31]       at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[rt.jar:1.8.0_31]       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[rt.jar:1.8.0_31]       at java.lang.reflect.Constructor.newInstance(Constructor.java:408)[rt.jar:1.8.0_31]       在org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)       ......还有27个   引起:java.lang.RuntimeException:无法启动redis服务器。检查日志以获取详细信       at redis.embedded.AbstractRedisInstance.awaitRedisServerReady(AbstractRedisInstance.java:66)       at redis.embedded.AbstractRedisInstance.start(AbstractRedisInstance.java:37)       at redis.embedded.RedisServer.start(RedisServer.java:11)       at org.egov.infra.config.redis.EmbeddedRedisServer.afterPropertiesSet(EmbeddedRedisServer.java:20)

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

在我的情况下,我在端口1337上运行嵌入式redis-server,当我在调试模式下运行我的测试用例时,此端口被锁定并进入循环。之后我还启动了spring-boot app,它在端口6379上创建了另一个服务器连接。但是我无法终止在端口1337上运行的服务器。从那时起,我在尝试执行测试用例时遇到了异常“Can启动redis服务器。检查日志以获取详细信息。“,因为1337被锁定了。调试line-my-line“AbstractRedisInstance”类和“awaitRedisServerReady”方法显示“1337已经在使用”,它从未被记录过。杀死了这个端口并重新运行了测试用例,我又一次在飞行中。希望这有帮助