tomcat部署項目報錯NoSuchMethodException#addServlet,addFilter

java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter

這個問題折騰了我三四天,現在終於找到原因了。
是web-inf/lib包下包含了catalina.jar這個jar包,導致加載的時候使用了這個jar但是沒有找到addServlet,addFilter
解決方法:Go to your WEB-INf/lib and remove catalina.*.jar, then restart your tomcat.

http://stackoverflow.com/questions/27102375/using-code-based-configuration-getting-java-lang-nosuchmethodexception-org-apac/27102430#27102430

還是老外的網站牛逼。百度了幾天答案千篇一律:解決方法爲:在Tomacat7的context.xml文件裏的中加上
http://nvry.iteye.com/blog/1726163

<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <Loader delegate="true" />
</Context>

可能能解決某些人的問題吧,反正解決不了我的問題。

######################
另一個問題:WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:firstProject’ did not find a matching property.

解決Setting property ‘source’ to 'org.eclipse.jst.jee.server的問題
http://blog.csdn.net/z69183787/article/details/19911935
這個教程對這個問題很全面的解決和分析

########## 還有一個問題 ###############
The method list(String, Object[]) is ambiguous for the type BaseDAOImpl<M,PK

http://www.cnblogs.com/wujianxingzhe/p/5623827.html
原因:eclipse 的一個bug,具體見http://stackoverflow.com/questions/10852923/method-is-ambiguous-for-the-type-but-the-types-are-not-ambigues-and-the-error 。
解決方法:在eclipse.ini -vmargs後面添加 -DtolerateIllegalAmbiguousVarargsInvocation=true ;重啓eclipse,並clean一下項目 重新編譯即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章