The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

jar files

hi all,
  our application is using one library to create xml document and tomcat is using another library for its xml document. both the library have same namespaces such as org.w3c.dom.* and depending on which library is loaded first, the call is going to that package classes.

so the problem we are facing is in some instances, tomcat library is getting loaded first and their class file  does not have some of the methods which we need but all the call are going to tomcat's library rather than the one we are using. so we get method not found error.

and i can't change the sequence of library loading.

how do we tell our application to explicitly use our library?

dan moore
Monday, July 11, 2005
The answer varies by version of Tomcat and the JRE you are using. My best guess without all the facts is that the DOM classes are actually being loaded by the JRE (as Tomcat takes great pains to maintain a classloader heirarchy that does not "leak" server implementation classes down to webapp classloaders). If I'm right, you'll want to google for "Java Endorsed Standard Override". This advice applies to JRE 1.4+

There are other possibilities but I feel that this is the most likely problem.
Monday, July 11, 2005
Can you determine if it's simply different versions of the same classes or is it a completely different handler?  You might be able to get away with updating the out of date jars directly.  Be sure to backup the old ones just in case...

I *KNOW* this was not the question, but have you considered using JDOM ( )?

I've been using it for about 3+ years and it's much better than the org.w3c classes and will prevent this problem from happening.  You might have to change your XML doc loading and/or your XSLT parsing, but it might be a better path for you.
KC Send private email
Monday, July 11, 2005
thanks every one for various solutions.

at the moment we are still riding on jdk 1.3 , in process moving to latest jdk but not soon enough for my liking.

the project is merging 2 xsl document. and
we are using import node in dom object to merge documents and hence the trouble.

yes i have used jdom a little and may be the route to go.

once again thanks

dan moore
Monday, July 11, 2005
Even with JDOM you may run into the "Endorsed" clas problem.    You may need to put a different version of Xerces.jar in your Tomcat's lib/endorsed directory to work around it.

Tuesday, July 12, 2005
I am not an apache/tomcat guy, but this seems pretty easy to solve.  Rename your .jars to .zips, unzip all the contents, use the jar tool to recombine the w3c stuff into its own jar, and not combined with the other jar.

Or if its the only set you use, just put all the classes into a single jar.

What am I missing?
Wednesday, July 13, 2005

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz