Guys, i was having a problem lately with my applet being run inside the browser (i already mentioned that in a previous post entitled: NoClassDefFoundError) and i have tracked down the cause of that issue (thanks guys who helped in the last post) to being the classLoader returning null inside the browser environemnt, while returning a correct classLoader inside jbuilder. The instruction i am using for returning a classLoader instance is the following: Thread.currentThread().getContextClassLoader(); and it is returning null in the browser environment...whyyyyy? Thanks guys, Best.. ---Mohammad
I'm surprised it doesn't throw a SecurityException, which the javadocs say it should in the presence of a SecurityManager. Is this a signed applet, or have you altered any policy files? Applet aren't generally allowed to work with ClassLaoders; that's a feature of the sandbox they live in inside of a browser.
Well, the issue is that i already signed the applet .. and still gives the same error Isn't there a classloader for applets running inside a browser? and how come it works under jbuilder (the instruction would return to me as a classloader : sun.applet.AppletClassLoader inside jbuilder) thanks a bunch..
Joined: Nov 17, 2005
Okay guys, here's the solution the problem was that the classLoader is null, so what i did was add a single instruction that is initiating the thread "loader.setContextClassLoader(this.getClass().getClassLoader());" this would set a classLoader to the thread and would remove all problems. Thanks guys for the help Best, ---Mohammad