-
1. Re: JMS ClassCastException on the lookup
spohl Feb 23, 2004 8:02 AM (in response to pbandino)The following solved my problems with java plugin technology (applets), ClassCastException and CLASSPATH:
http://forum.java.sun.com/thread.jsp?thread=432365&forum=40&message=1934477
for convenience & full-text-search purposes:
"I had a similar problem when I was trying to use JNDI from java code invoked by the bridge. Running the same java code from the command line worked fine, invoking it through the bridge spat out a ClassNotFound.
I tracked the problem to the classloading mechanism used by JNDI, which relies on the context class loader (see the javadoc for java.lang.Thread). The bridge does not set the context class loader (leaving it null), which results in JNDI trying to load the InitialContextFactory implementation from the bootstrap classloader. The bootstrap classloader only loads the most essential libraries (rt.jar primarily), and does not see your extended classpath.
My solution was to insert a setContextClassloader call in my Java code, setting the context classloader to the classloader of my own class. That solved the problem in my case.
Hope this can help you,
Maarten"