问答详情
源自:5-2 Shiro会话管理2

启动报错,启动不了


at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)

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

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

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

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)

... 60 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionManager' defined in class path resource [spring/spring.xml]: Cannot resolve reference to bean 'redisSessionDao' while setting bean property 'sessionDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisSessionDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisUtil': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private redis.clients.jedis.JedisPool com.imooc.util.JedisUtil.jedisPool; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisPool' defined in class path resource [spring/spring-redis.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.clients.jedis.JedisPool]: Constructor threw exception; nested exception is redis.clients.jedis.exceptions.InvalidURIException: Cannot open Redis connection due invalid URI. 127.0.0.1

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1475)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1220)

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

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

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)

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

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

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

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)

... 70 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisSessionDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisUtil': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private redis.clients.jedis.JedisPool com.imooc.util.JedisUtil.jedisPool; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisPool' defined in class path resource [spring/spring-redis.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.clients.jedis.JedisPool]: Constructor threw exception; nested exception is redis.clients.jedis.exceptions.InvalidURIException: Cannot open Redis connection due invalid URI. 127.0.0.1

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:308)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)

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

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

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)

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

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

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

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)

... 80 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisUtil': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private redis.clients.jedis.JedisPool com.imooc.util.JedisUtil.jedisPool; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisPool' defined in class path resource [spring/spring-redis.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.clients.jedis.JedisPool]: Constructor threw exception; nested exception is redis.clients.jedis.exceptions.InvalidURIException: Cannot open Redis connection due invalid URI. 127.0.0.1

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)

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

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

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)

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

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

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

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:461)

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:435)

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:559)

at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)

... 88 more

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private redis.clients.jedis.JedisPool com.imooc.util.JedisUtil.jedisPool; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisPool' defined in class path resource [spring/spring-redis.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.clients.jedis.JedisPool]: Constructor threw exception; nested exception is redis.clients.jedis.exceptions.InvalidURIException: Cannot open Redis connection due invalid URI. 127.0.0.1

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)

... 101 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisPool' defined in class path resource [spring/spring-redis.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.clients.jedis.JedisPool]: Constructor threw exception; nested exception is redis.clients.jedis.exceptions.InvalidURIException: Cannot open Redis connection due invalid URI. 127.0.0.1

at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1137)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1040)

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

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

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)

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

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

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

at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)

... 103 more

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.clients.jedis.JedisPool]: Constructor threw exception; nested exception is redis.clients.jedis.exceptions.InvalidURIException: Cannot open Redis connection due invalid URI. 127.0.0.1

at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)

at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)

at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:267)

... 115 more

Caused by: redis.clients.jedis.exceptions.InvalidURIException: Cannot open Redis connection due invalid URI. 127.0.0.1

at redis.clients.jedis.JedisFactory.<init>(JedisFactory.java:53)

at redis.clients.jedis.JedisPool.<init>(JedisPool.java:212)

at redis.clients.jedis.JedisPool.<init>(JedisPool.java:201)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)

... 117 more


28-May-2018 15:56:47.540 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file

28-May-2018 15:56:47.544 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors

[2018-05-28 03:56:47,561] Artifact shiro-web:war exploded: Error during artifact deployment. See server log for details.

28-May-2018 15:56:54.789 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [F:\Program Files (x86)\apache\apache-tomcat-8.5.15\webapps\manager]

28-May-2018 15:56:54.858 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [F:\Program Files (x86)\apache\apache-tomcat-8.5.15\webapps\manager] has finished in [69] ms


提问者:qq_左手边_3 2018-05-28 16:07

个回答

  • 侧耳听
    2018-05-31 00:17:04

    要安装redis ,并启动

    http://www.redis.net.cn/tutorial/3503.html

  • qq_左手边_3
    2018-05-29 14:06:13

    你的这块学习完了吗?方便发一下你的源码给我吗?

  • 比遗忘的人
    2018-05-29 13:22:09

    先在CustomSessionManager里面打断点,应该可以避免500




  • qq_左手边_3
    2018-05-28 18:35:42

    之前那个错解决了,但是登录的时候报错

    HTTP Status [500] – [Internal Server Error]


    Type Exception Report

    Message Request processing failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

    Description The server encountered an unexpected condition that prevented it from fulfilling the request.

    Exception

    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:977)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:867)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:841)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
    	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    	org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    	org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    	org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    	org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    	org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    	org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    	org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    	org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    	org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    	org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    	org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    	org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

    Root Cause

    redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    	redis.clients.util.Pool.getResource(Pool.java:50)
    	redis.clients.jedis.JedisPool.getResource(JedisPool.java:99)
    	com.imooc.util.JedisUtil.getResource(JedisUtil.java:20)
    	com.imooc.util.JedisUtil.set(JedisUtil.java:24)
    	com.imooc.session.RedisSessionDao.saveSession(RedisSessionDao.java:34)
    	com.imooc.session.RedisSessionDao.doCreate(RedisSessionDao.java:43)
    	org.apache.shiro.session.mgt.eis.AbstractSessionDAO.create(AbstractSessionDAO.java:116)
    	org.apache.shiro.session.mgt.DefaultSessionManager.create(DefaultSessionManager.java:177)
    	org.apache.shiro.session.mgt.DefaultSessionManager.doCreateSession(DefaultSessionManager.java:158)
    	org.apache.shiro.session.mgt.AbstractValidatingSessionManager.createSession(AbstractValidatingSessionManager.java:136)
    	org.apache.shiro.session.mgt.AbstractNativeSessionManager.start(AbstractNativeSessionManager.java:99)
    	org.apache.shiro.mgt.SessionsSecurityManager.start(SessionsSecurityManager.java:152)
    	org.apache.shiro.subject.support.DelegatingSubject.getSession(DelegatingSubject.java:336)
    	org.apache.shiro.subject.support.DelegatingSubject.getSession(DelegatingSubject.java:312)
    	org.apache.shiro.mgt.DefaultSubjectDAO.mergePrincipals(DefaultSubjectDAO.java:204)
    	org.apache.shiro.mgt.DefaultSubjectDAO.saveToSession(DefaultSubjectDAO.java:166)
    	org.apache.shiro.mgt.DefaultSubjectDAO.save(DefaultSubjectDAO.java:147)
    	org.apache.shiro.mgt.DefaultSecurityManager.save(DefaultSecurityManager.java:383)
    	org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:350)
    	org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:183)
    	org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:283)
    	org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
    	com.imooc.controller.UserController.subLogin(UserController.java:27)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	java.lang.reflect.Method.invoke(Method.java:498)
    	org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
    	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
    	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:775)
    	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
    	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:867)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:841)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
    	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    	org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    	org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    	org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    	org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    	org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    	org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    	org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    	org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    	org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    	org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    	org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    	org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

    Root Cause

    redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect
    	redis.clients.jedis.Connection.connect(Connection.java:164)
    	redis.clients.jedis.BinaryClient.connect(BinaryClient.java:80)
    	redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1676)
    	redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:87)
    	org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:861)
    	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
    	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
    	redis.clients.util.Pool.getResource(Pool.java:48)
    	redis.clients.jedis.JedisPool.getResource(JedisPool.java:99)
    	com.imooc.util.JedisUtil.getResource(JedisUtil.java:20)
    	com.imooc.util.JedisUtil.set(JedisUtil.java:24)
    	com.imooc.session.RedisSessionDao.saveSession(RedisSessionDao.java:34)
    	com.imooc.session.RedisSessionDao.doCreate(RedisSessionDao.java:43)
    	org.apache.shiro.session.mgt.eis.AbstractSessionDAO.create(AbstractSessionDAO.java:116)
    	org.apache.shiro.session.mgt.DefaultSessionManager.create(DefaultSessionManager.java:177)
    	org.apache.shiro.session.mgt.DefaultSessionManager.doCreateSession(DefaultSessionManager.java:158)
    	org.apache.shiro.session.mgt.AbstractValidatingSessionManager.createSession(AbstractValidatingSessionManager.java:136)
    	org.apache.shiro.session.mgt.AbstractNativeSessionManager.start(AbstractNativeSessionManager.java:99)
    	org.apache.shiro.mgt.SessionsSecurityManager.start(SessionsSecurityManager.java:152)
    	org.apache.shiro.subject.support.DelegatingSubject.getSession(DelegatingSubject.java:336)
    	org.apache.shiro.subject.support.DelegatingSubject.getSession(DelegatingSubject.java:312)
    	org.apache.shiro.mgt.DefaultSubjectDAO.mergePrincipals(DefaultSubjectDAO.java:204)
    	org.apache.shiro.mgt.DefaultSubjectDAO.saveToSession(DefaultSubjectDAO.java:166)
    	org.apache.shiro.mgt.DefaultSubjectDAO.save(DefaultSubjectDAO.java:147)
    	org.apache.shiro.mgt.DefaultSecurityManager.save(DefaultSecurityManager.java:383)
    	org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:350)
    	org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:183)
    	org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:283)
    	org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
    	com.imooc.controller.UserController.subLogin(UserController.java:27)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	java.lang.reflect.Method.invoke(Method.java:498)
    	org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
    	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
    	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:775)
    	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
    	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:867)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:841)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
    	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    	org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    	org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    	org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    	org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    	org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    	org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    	org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    	org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    	org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    	org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    	org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    	org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

    Root Cause

    java.net.ConnectException: Connection refused: connect
    	java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    	java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
    	java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    	java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    	java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    	java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    	java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    	java.net.Socket.connect(Socket.java:589)
    	redis.clients.jedis.Connection.connect(Connection.java:158)
    	redis.clients.jedis.BinaryClient.connect(BinaryClient.java:80)
    	redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1676)
    	redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:87)
    	org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:861)
    	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
    	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
    	redis.clients.util.Pool.getResource(Pool.java:48)
    	redis.clients.jedis.JedisPool.getResource(JedisPool.java:99)
    	com.imooc.util.JedisUtil.getResource(JedisUtil.java:20)
    	com.imooc.util.JedisUtil.set(JedisUtil.java:24)
    	com.imooc.session.RedisSessionDao.saveSession(RedisSessionDao.java:34)
    	com.imooc.session.RedisSessionDao.doCreate(RedisSessionDao.java:43)
    	org.apache.shiro.session.mgt.eis.AbstractSessionDAO.create(AbstractSessionDAO.java:116)
    	org.apache.shiro.session.mgt.DefaultSessionManager.create(DefaultSessionManager.java:177)
    	org.apache.shiro.session.mgt.DefaultSessionManager.doCreateSession(DefaultSessionManager.java:158)
    	org.apache.shiro.session.mgt.AbstractValidatingSessionManager.createSession(AbstractValidatingSessionManager.java:136)
    	org.apache.shiro.session.mgt.AbstractNativeSessionManager.start(AbstractNativeSessionManager.java:99)
    	org.apache.shiro.mgt.SessionsSecurityManager.start(SessionsSecurityManager.java:152)
    	org.apache.shiro.subject.support.DelegatingSubject.getSession(DelegatingSubject.java:336)
    	org.apache.shiro.subject.support.DelegatingSubject.getSession(DelegatingSubject.java:312)
    	org.apache.shiro.mgt.DefaultSubjectDAO.mergePrincipals(DefaultSubjectDAO.java:204)
    	org.apache.shiro.mgt.DefaultSubjectDAO.saveToSession(DefaultSubjectDAO.java:166)
    	org.apache.shiro.mgt.DefaultSubjectDAO.save(DefaultSubjectDAO.java:147)
    	org.apache.shiro.mgt.DefaultSecurityManager.save(DefaultSecurityManager.java:383)
    	org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:350)
    	org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:183)
    	org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:283)
    	org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
    	com.imooc.controller.UserController.subLogin(UserController.java:27)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	java.lang.reflect.Method.invoke(Method.java:498)
    	org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
    	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
    	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:775)
    	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
    	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:867)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:841)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
    	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    	org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    	org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    	org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    	org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    	org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    	org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    	org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    	org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    	org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    	org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    	org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    	org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

    Note The full stack trace of the root cause is available in the server logs.


    Apache Tomcat/8.5.15


  • qq_左手边_3
    2018-05-28 17:33:22

    改了之后启动成功了,但是页面上报错

    HTTP Status [405] – [Method Not Allowed]


    Type Status Report

    Message Request method 'GET' not supported

    Description The method received in the request-line is known by the origin server but not supported by the target resource.


    Apache Tomcat/8.5.15



  • 比遗忘的人
    2018-05-28 17:07:17

    把spring-redis.xml改成以下(事前要安装redis,并启动)

    <bean class="redis.clients.jedis.JedisPool" id="jedisPool">
      <constructor-arg ref="jedisPoolConfig"/>
      <constructor-arg value="127.0.0.1"/>
    </bean>
    
    <bean class="redis.clients.jedis.JedisPoolConfig" id="jedisPoolConfig"/>