springside4啟動報錯,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編寫代碼太卡了,關閉了自動編譯選項: