We're deploying a WAR file into Tomcat 5.5 and it works fine if WEB-INF\classes contains .classes files, but if we move the .jar file containing that .classes into WEB-INF\lib, we get an exception on runtime complaining that java.lang.NoSuchMethodError, but existing class file in .jar file contains the class and method does exits!
Any help on this would be appreciated.
This could be caused due to a class conflict. Make sure that there isn't an older version of the Class somewhere (Tomcat's shared folder, WEB-INF/classes, WEB-INF/lib). If this is the case, you practically can't know which class Tomcat will load. If it picks one without the method, the exception you are experiencing will occur.
Since you are getting a NoSuchMethodError, and not a ClassNotFoundError, it means that you have an old version of the class somewhere (outside of the jar file). You need to find and remove it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With