当前位置 博文首页 > 闫玉林的博客:NoSuchMethodError报错和Tomcat的jar包加载顺序
Java
项目,使用maven
管理jar
包,war
包部署,Tomcat
服务器java.lang.NoSuchMethodError
Windows
上是可以的,Tomcat7
也可以,但是centos7 + Tomcat 8.5
就会报错。conf
下的context.xml
,来指定优先加载部分需要的jar包。<Context>
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<Resources>
<PreResources className="org.apache.catalina.webresources.FileResourceSet"
base="/home/webroot/ls-static-web/WEB-INF/lib/ls-aacustom-common-1.0-SNAPSHOT.jar"
webAppMount="/WEB-INF/lib/ls-aacustom-common-1.0-SNAPSHOT.jar" />
<PreResources className="org.apache.catalina.webresources.FileResourceSet"
base="/home/webroot/ls-static-web/WEB-INF/lib/ls-aacustom-static-1.0-SNAPSHOT.jar"
webAppMount="/WEB-INF/lib/ls-aacustom-static-1.0-SNAPSHOT.jar" />
</Resources>
</Context>