Peter,
you're exactly right.

***code***
Class c1 = request.getUserPrincipal().getClass(); //get the class of the Principal that tomcat created , which is a MemoryUser instance
Class c2 = MemoryUser.class; // get the class loaded by the current loader
System.out.println(c1.getClassLoader().getClass.getName()); //prints "org.apache.catalina.loader.StandardClassLoader" System.out.println(c2.getClassLoader().getClass.getName()); //prints "org.apache.catalina.loader.WebappClassLoader"

Great, so now I've got two different classloaders. Do you know if there's any way I can cast the Principal to a Memoryuser object and use it? do I have to load the MemoryUser class in the current classloader?

full kudos for figuring out the problem exactly, I never would have thought of that!

ps - This would be entertaining, if only I was the one who got to watch someone else wade through this!

Peter Crowther wrote:
From: Matthew Kerle [mailto:[EMAIL PROTECTED] So what this is saying is that the *names* of the classes are the same, but the actual classes are different. this is crazy...

I suspect the two classes are being loaded by different classloaders - a
common and entertaining* problem in Tomcat and other servlet containers.
You can find out by asking each for its classloader and comparing.

                - Peter

* Depending on whether you're watching someone else try to solve the
problem, or having to wade through it yourself.  Best of luck!



--
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : [EMAIL PROTECTED]
Web : http://threebrightlights.blogspot.com/


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to