jboss classloading and javax.net.ssl.HostnameVerifier
michaw Oct 10, 2008 8:46 AMI have a problem with the classloading in JBoss (4.2.2.GA). With loading my implementation of the javax.net.ssl.HostnameVerifier to be more specific.
I have one server /bin/jboss-4.2.2.GA/server/myserver which contains two ears.
Both contain a war and those both use a custum implementation of the javax.net.ssl.HostnameVerifier. But different versions.
This gives me a structure like this
myserver + deploy + newerproj.ear | + META-INF | | + jboss-app.xml | | | + newerproj.war | + META-INF | | | + WEB-INF | + lib | + myjar2.jar | + my.package.Verifier (i.e. version 2) | + olderproj.ear + META-INF | | + jboss-app.xml | + olderproj.war + META-INF | + WEB-INF + lib + myjar1.jar + my.package.Verifier (i.e. version 1)
The two jboss-app.xml files look like this:
newproj.ear - jboss-app.xml: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd"> <jboss-app> <loader-repository>my.own.package.newerear:loader=newerear.ear</loader-repository> </jboss-app> olderproj.ear - jboss-app.xml: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd"> <jboss-app> <loader-repository>my.own.package.olderear:loader=olderear.ear</loader-repository> </jboss-app>
In both applications I call this statement before making a network connection.
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new Verifier());
In the versions of the Verifier I have different log statements in the verify(String, SSLSession).
What I notice is that when I call a page in the newerproj.ear I get the logstatement from verions 1 of the Verifier, not of version 2. And ofcourse the functionality of version 1.
My guess is this:
the HttpsURLConnection class is part of the jre. Calling the static setDefaultHostnameVerifier() on that class sets it for the jboss-server instance.
Not for the application. I.e. the HttpsURLConnection class is shared by both applications and therefore use the same version of the Verifier.
My question:
Is there a way to get both applications to use their own version of the Verifier?