0

Jboss-allclient.jar and jboss-logging.jar have a class org.jboss.logging.Logger , where the methods defined inside the classes are different but the package structure is same for both the classes. Due to which i have got an exception on deployment.

Exception

NoSuchMethodException of getMessage()

This is because, getMessage() method is present in one class alone. Unfortunately, it picks the wrong class and throws an exception.

Note :

This is working in tomcat 7 (windows and linux version) and tomcat8 (Windows)
Not working in tomcat 8 (Linux version). JRE version is 8

Those two jars needed for my application.

  • Please see http://stackoverflow.com/questions/5474765/order-of-loading-jar-files-from-lib-directory – Pankaj Pandey Jan 20 '16 at 15:42
  • @PankajPandey. i went through the given link, Didnt get the answer for my question. my question is , what do i need to get rid off this problem? i have both jars under WEB-INF/lib/ and the mentioned class exists in both jars. but the definition of the classes is different. Thats is why i am getting this exception only in tomcat 8 (Linux version). Not with tomcat 7 (windows and linux) and tomcat 8 (Windows version). – Balasubramanian Ramar Jan 21 '16 at 06:09
  • That link described the order of class loading , before tomcat 8 the order was alphabetic but in tomcat 8 the order is random and dependent on underlying os. The workaround is if you move your one of your low order jar file into tomcat/lib, then it may work.please try. – Pankaj Pandey Jan 21 '16 at 09:18

1 Answers1

1

In Tomcat 8 the sequence of loading jars within a single war is not guaranteed. Before it was alphabetical.

It was reported as a bug to Apache, but they claim it's a feature ;) Check https://bz.apache.org/bugzilla/show_bug.cgi?id=57129

One of the devs has come up with a workaround, but I have not tried it. You can have a look on https://github.com/openwide-java/tomcat-classloader-ordered

Good luck!