cancel
Showing results for 
Search instead for 
Did you mean: 

Heavy loading of jaxb classes

Former Member
0 Kudos

Hi,

We need to use the latest jaxb 2.1 libraries in our application. We are using netweaver 7.1 CE and it seems to ship with jaxb 2.0 libs. (file:/usr/sap/CE7/J00/j2ee/cluster/bin/ext/jaxb20/jaxb-impl.jar)

We are already using heavy loading for the hibernate classes, and I assumed I could to the same for jaxb. The dump of the heavy loaded classes from telnet is as follows:

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/javassist-3.4.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/hibernate-entitymanager-3.3.2.GA.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/asm-1.5.3.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/antlr-2.7.6.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/commons-collections-3.1.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/hibernate-commons-annotations-3.0.0.GA.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/jaxb-xjc-2.1.7.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/hibernate-annotations-3.3.1.GA.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/jaxb-impl-2.1.7.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/log4j-1.2.15.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/asm-attrs-1.5.3.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/jaxb-api-2.1.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/commons-logging-1.0.4.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/cglib-2.1.3.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/ehcache-1.5.0.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/dom4j-1.6.1.jar

/usr/sap/CE7/J00/j2ee/cluster/apps/sap.com/Manifest/app_libraries_container/lib/hibernate-3.2.6.ga.jar

The jaxb classes is included, but it does not seem that my jaxb libraries is used by my application. I've added a util method to do o lookup of the classloader of the jaxb class that I get hold of in the app, and it is still the original jaxb2.0

Is this the correct approach to use a newer JAXB or is there some other way of doing it?

Regards Jaco

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Johann,

Is the application that uses (or: should use) the new jaxb classes the same that jaxb-2.1 is included with?

Because if not (and it only has the reference to the first application in application-j2ee-engine.xml file), it will not succeed. The reason is that in such situation the "main" application's classloader would have (at least) the following parents:

- all server's "standard" libraries etc. (somewhere here jaxb-2.0 is loaded)

- your heavy loader (where jaxb-2.1 is loaded)

Then, in case of conflict, the app server's classes will be loaded first anyway...

So you have to refer to jaxb from the same deployable module that your version of jaxb is bundled in. If this is your case, I have no idea what's wrong...

Good luck,

-Milosz

Answers (2)

Answers (2)

Former Member
0 Kudos

In the NetWeaver you can make one application dependent on another one using the [application-j2ee-engine.xml|http://help.sap.com/saphelp_nwce10/helpdata/en/45/053c1041f30486e10000000a155369/content.htm] descriptor.

If you have YourApp.ear, and HibernateJars.ear (the latter one as "Heavy Library"), in the YourApp.ear/META-INF/application-j2ee-engine.xml you could write:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
 <application-j2ee-engine> 
	<provider-name>yourcompany.com</provider-name>
	<reference reference-type="hard">
		<reference-target target-type="application" provider-name="yourcompany.com">HibernateJars</reference-target>
	</reference>
</application-j2ee-engine>

In such case, the HibernateJars' classloader will not see the jaxb classes loaded by server, and whatever refers to jaxb there - will use the version you want. BUT, YourApp's classloader will use the jaxb version loaded on server.

I know this may still be confusing... I would recommend you to browse through the classloader viewer on the web console (port 50000):

SAP NetWeaver Administrator > Problem Management > Classloader viewer > Java Class Loader Viewer

(find the classloaders of your applications and browse through Children, Parents and Resources tabs -

this is where I understood the NetWeaver's classloading approach

Former Member
0 Kudos

Hi Milosz,

Thanks for the reply, but I don't really understand what you mean. Would it be possible to give me a bit more concrete example.

In the mean time I have just replaced the jaxb20 libs in the server classpath with my jaxb21 libs and it works fine. This is obviously not a solution, but allows me to continue for the time being.

Thanks Jaco