dcsimg
WebappClassLoader loads incomplete classes
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   michael_Stevens
Posted On:   Tuesday, April 1, 2008 07:57 PM

This came up due to a Hibernate warning about composite ID classes, but the behavior I'm seeing in Tomcat 6 is this: org.apache.catalina.loader.WebappClassLoader.loadClass(String name) is returning a Class that does not include any of the class' public methods. So, classObject.getMethod("methodName", params[]) never succeeds, even when the class *does* define public methods. (All of this while the classes behave normally when called upon; the problem only seems to occur when using reflection to load a Class and examine its methods.) Of course, executing the same code with a different classloader (for instance, sun.misc.Launcher$AppClassLoader) returns a class complete with   More>>

This came up due to a Hibernate warning about composite ID classes, but the behavior I'm seeing in Tomcat 6 is this:


org.apache.catalina.loader.WebappClassLoader.loadClass(String name) is returning a Class that does not include any of the class' public methods.


So, classObject.getMethod("methodName", params[]) never succeeds, even when the class *does* define public methods.


(All of this while the classes behave normally when called upon; the problem only seems to occur when using reflection to load a Class and examine its methods.)


Of course, executing the same code with a different classloader (for instance, sun.misc.Launcher$AppClassLoader) returns a class complete with all public methods.


Does anyone know why WebappClassLoader might be doing this?

   <<Less

Re: WebappClassLoader loads incomplete classes

Posted By:   michael_Stevens  
Posted On:   Wednesday, April 2, 2008 02:13 PM

I found the answer. The class loader loads classes as expected. I'm using Eclipse, and my container was loading old class definitions from an outdated jar in my WTP webapp lib. Got some kinks to iron out in my maven/eclipse/wtp conglomeration, I guess.
About | Sitemap | Contact