Problem deploying Tomcat using jar file instead of classes

We deploy the WAR file in Tomcat 5.5, and it works fine if the WEB-INF \ classes contain .classes files, but if we move the .jar file containing this .classes to WEB-INF \ lib, we get an exception from the runtime complaining that java.lang.NoSuchMethodError, but the existing class file in the .jar file contains the class and the method exits!

Any help on this would be appreciated.

+3
source share
4 answers

This may be due to a class conflict. Make sure there is no previous version of the class (Tomcat public folder, WEB-INF / classes, WEB-INF / lib). If so, you have almost no idea which Tomcat class will be loaded. If he chooses one without a method, the exception you are experiencing will occur.

+5
source

Since you are getting a NoSuchMethodError, not a ClassNotFoundError, this means that you have an old version of the class somewhere (outside the jar file). You need to find and delete it.

+1
source

closin , http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html#Class%20Loader%20Definitions

, WEB-INF/classes , WEB-INF/lib. ( ). , . lib, ( , - )

.

,  -

0

- :

JVM
( )
/WEB -INF/ -
/WEB -INF/lib/*.jar -
( )

, "Common class loader", common.loader $CATALINA_BASE/conf/catalina.properties. / ;
shared.loader = ${catalina.base}/shared/classes, ${catalina.base}/shared/lib/*. jar

, .

0

Source: https://habr.com/ru/post/1711986/


All Articles