在學習Springside的實例mini-web的時候遇到了Tomcat報錯:
嚴重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
嚴重: Error configuring application listener of class org.springframework.web.util.IntrospectorCleanupListener
java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
排除maven沒有配置依賴(dependency)的緣由。
稍後,在查看Eclipse的Maker視窗是發現了一個警告,描述以下:
Description
Resource
Path
Location
Type
Classpath entry org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result.
mini-web
P/mini-web
Classpath Dependency Validator Message
右鍵選擇了Quick Fix,彈出窗提示Select A Fix,我選擇了第一項:
而後重啓Tomcat,找不到類的錯誤沒有了!
中間還發生了找不到mysql的jdbc驅動的小插曲,經查:雖然改了application.properties把參數從H2切到了mysql,可是查看pom.xml
<jdbc.driver.groupId>mysql</jdbc.driver.groupId>
<jdbc.driver.artifactId>mysql-connector-java</jdbc.driver.artifactId>
<jdbc.driver.version>5.1.13</jdbc.driver.version>
原來是這一段依賴的註釋沒有去掉,雖然是小case,可是因爲前面的問題的長時間困擾糾結,感受大囧o(╯□╰)o
迴歸正題,問題解決了,那麼Quick Fix先後的變化在哪兒呢?
變化以下圖所描述的,增長了一條 「Publish/export dependency:/EWB-INF/lib」的東東。
按理說能夠自動加的手動應該也能夠加,但是我折騰半天硬是沒有找到方法手動加上這一條,又感受大囧o(╯□╰)o
求高手解答,小弟感激涕零!
PS:日常不多看Eclipse裏面的 warnings 的,今天看來原來仍是本身關注太少了,一些問題雖然不能致使錯誤,可是缺乏了也是會讓行動步履維艱的o(╯□╰)o