maven+ssm項目啟動報錯:
org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [X:\IDEAWorkspace\easyPartTimeJob\target\easyPartTimeJob-1.0-SNAPSHOT\WEB-INF\classes\com\fireDragon\bo\AccountInfoBO.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [X:\IDEAWorkspace\easyPartTimeJob\target\easyPartTimeJob-1.0-SNAPSHOT\WEB-INF\classes\com\fireDragon\bo\AccountInfoBO.class]; nested exception is java.lang.IllegalArgumentException
日志很詳細,但是我找了很久都找不出原因(看不懂)。百度上的博客看了個遍。然后我對着一個網上的ssm整合教程重新寫了一個整合demo,這個可以啟動了,於是我得到了一個可以跑起來的項目。
我對照各個層次的代碼發現沒錯后,對比pom文件,使用控制變量法一個一個排除(哭卿卿),發現了罪魁禍首:一個jar包:(刪除這個東西即可啟動項目),原因是jar包沖突了,ORZ。
然后訪問一個我寫的測試接口,發現報了一個新的錯誤:
我的是Spring版本問題,由5.0.8換為4.3.9即可(大俠隨機應變)。解決這兩個問題后,我的demo就可以跑通各層了。
建議:如果整合時確保代碼無誤,可以往spring版本及jar包沖突方面考慮!這種錯誤有可能人人不一樣,但是我找個BUG找了三天,覺得還是有必要記錄一下(doge)