Hi Brad

Brad Wetmore wrote:


On the production machine it was a common-httpclient.jar in the J2RE_LIBRARY/ext


I assuming this points to <java-home>/lib/ext, and that we're talking about standard extensions.

And the classLoader was not loading the SecureProtocolSocketFactory from my jar but from this common-httpclient.jar in the J2RE_LIBRARY/ext
I have deleted common-httpclient.jar in the J2RE_LIBRARY/ext and now it works.


I really have difficulties to understand how classLoader works. I am comming from C language, with .a static it was simple, with dynamic .so it is still possible to understand. But here I really don't understand.

When I am launching the appli I do :
java -jar myjar.jar

So I don't understand why this stupid loader go get anything in J2RE_LIBRARY/ext and use it with higher priority than elements in my jar.


The short answer is that Java searches/loads bootstrap classes (java.io, java.lang, etc) first, then classes found in the extensions directory, before loading user classes (i.e. -classpath). The extensions directory is kind of a "second" system classes area.

Thank's Brad. I understand better now. For inheritance reasons it seems to me natural that load would be from particular to generic.
But now I will take a particular attention to ext content.


Have a look at the classloader info for the extension mechanism.

http://java.sun.com/docs/books/tutorial/ext/index.html
http://java.sun.com/j2se/1.5.0/docs/guide/extensions/index.html

or have a look at the Java 2 Platform Security book (Gong/Elison/Dageforde) section 4 on secure classloaders for much more detailed info on the actual class search/load mechanism.

The classloading mechanism including the classloader hierarchy and delegation model is too hard to explain in a quick email.

Brad


Cheers

Andre

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to