Tomcat 7 How ClassLoader loads from 2 webapps, same package/classes hierarchy, different classes?

887 views Asked by At

I have this scenario:

  1. //Tomcat7/webapps/app1/WEB-INF/classes/a/b/c/A.class
  2. //Tomcat7/webapps/app1/WEB-INF/classes/a/b/c/B.class
  3. //Tomcat7/webapps/app2/WEB-INF/classes/a/b/c/B.class (different class but same name as <2>)
  4. //Tomcat7/webapps/app2/WEB-INF/classes/a/b/c/C.class

Note: class directory hierarchy is the same, just the class file is different.

The log file for app1 contains NoClassDefFoundError for A.class. Checked the directory, class file definitely is there. Now I am trying to figure out if it is possible that the ClassLoader loaded only B.class and not A.class, although there should be a ClassLoader for each webapps - meaning two ClassLoaders?

Any ideas how this works?

EDIT: Tomcat7 is started via Tanuki JWS. From wrapper.log, I can see that app2 is initialized first, then only app1.

Regards, Allan

1

There are 1 answers

1
allancth On

This issue was solved after Tomcat7 was restarted. Root cause cannot be identified.