springside4启动报错

技术分享

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘shiroFilter‘ defined in URL [file:/D:/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/flowers/WEB-INF/classes/applicationContext-shiro.xml]: Cannot resolve reference to bean ‘securityManager‘ while setting bean property ‘securityManager‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘securityManager‘ defined in URL [file:/D:/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/flowers/WEB-INF/classes/applicationContext-shiro.xml]: Cannot resolve reference to bean ‘shiroDbRealm‘ while setting bean property ‘realm‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘shiroDbRealm‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException


很奇葩有木有,首先想到的是XML配置错了?定位到D:/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/flowers/WEB-INF/classes/applicationContext-shiro.xml,发现配置文件存在,那么是配置信息中securityManager的配置有错误,或者securityManager、shiroDbRealm相关的类有问题……但是配置貌似也没错误。至少这个ShiroDbRealm是SpringSide例子自带的,demo上运行是没问题,不应该有错误的,那么为啥类不能被加载??这种情况不是类没编写就是类没编译成class文件啊!尝试以下操作,编译项目:

技术分享

再次运行,启动成功!

十二月 30, 2014 1:56:45 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'springServlet'
十二月 30, 2014 1:56:46 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-nio-80"]
十二月 30, 2014 1:56:46 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-nio-8080"]
十二月 30, 2014 1:56:46 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-nio-8009"]
十二月 30, 2014 1:56:46 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 13171 ms
PS:当时Eclipse编写代码太卡了,关闭了自动编译选项:

技术分享

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。