Balasubramanian Ramar
Balasubramanian Ramar

Reputation: 321

how tomcat will load the class if duplicate classes exist with same package structure

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.

Upvotes: 0

Views: 1423

Answers (1)

Wannabe Programmer
Wannabe Programmer

Reputation: 31

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!

Upvotes: 1

Related Questions