Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xalan and JDK1.4.1

Status
Not open for further replies.

thrybergh

MIS
Feb 10, 2003
52
0
0
GB
Hello.

I wonder if anyone has any experience of this problem?

I am using JDK1.4.1 and Xalan 2.5.D11. The xalan.jar is in the endorsed directory for Tomcat and I have tested the version number by printing it to the screen. I am confused as to why I get the "NoClassDefFoundError" since the xalan.jar is accessible. [sadeyes] I am getting a combination of the later Xalan version and the version included in JDK1.4?

The webapp is hosted by jsp-servlets.net, so I do not have full access to the Tomcat config.

Any ideas would be appreciated! [smile]



java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at org.apache.xalan.serialize.SerializerFactory.getSerializer(SerializerFactory.java:125)
at org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:1045)
at org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:972)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1121)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1104)
at flan.predictions.servlet.RequestHandler.outputXML(RequestHandler.java:175)
at flan.predictions.servlet.SignIn$SignInRequestHandler.formatOutput(SignIn.java:117)
at flan.predictions.servlet.PredictionsServlet.doRequest(PredictionsServlet.java:101)
at flan.predictions.servlet.PredictionsServlet.doGet(PredictionsServlet.java:252)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 
I've just thought of something:

I did not include the Xalan 2.5 jar in the classpath when I compiled it, and have used the version built in to the JDK1.4.1. Is this the most likely problem?
 
>> Is this the most likely problem?

Does not seem likely. Look at the Class Loader documentation for Tomcat. It explaines exactly the order in which libraries are searched/loaded. That should explain things for you. I think the applications library folder is the first location searched and then maybe after that it goes all the way back down to the JRE. If so that would mean you need to put it in the applications lib folder.

-pete
 
Hello palbano.

I am still getting the same NoClassDefError so did a bit more investigation.

I have been checking the versions of Xalan, Xerces and JDK that I am using. My app is seeing the new Xalan version OK. Another important difference is that I compile on Win98 and run on Linux.

#---- BEGIN writeEnvironmentReport($Revision: 1.17 $): Useful stuff found: ----
java.version=1.4.1_01
version.xalan2x=Xalan Java 2.5.D1
version.JAXP=1.1
version.SAX=2.0
version.crimson=present-unknown-version
java.class.path=WARNING: SecurityException thrown accessing system classpath properties
version.ant=not-present
sun.boot.class.path=/home/tomcat41/common/endorsed/xercesImpl.jar
:/home/tomcat41/common/endorsed/xmlParserAPIs.jar
:/home/tomcat41/common/endorsed/xalan.jar
:/opt/j2sdk1.4.1_01/jre/lib/rt.jar
:/opt/j2sdk1.4.1_01/jre/lib/i18n.jar
:/opt/j2sdk1.4.1_01/jre/lib/sunrsasign.jar
:/opt/j2sdk1.4.1_01/jre/lib/jsse.jar
:/opt/j2sdk1.4.1_01/jre/lib/jce.jar
:/opt/j2sdk1.4.1_01/jre/lib/charsets.jar
:/opt/j2sdk1.4.1_01/jre/classes
version.DOM.draftlevel=2.0fd
version.DOM=2.0
version.xalan1=not-present
version.xalan2_2=Xalan Java 2.5.D1
version.xerces2=Xerces-J 2.3.0
version.xerces1=not-present
#----- END writeEnvironmentReport: Useful properties found: -----
# YAHOO! Your environment seems to be OK.
 
haven't used the Tomcat endorsed directory yet, but the one way to get xalan jars to be loaded in advance of the jre1.4 versions is to create an endorsed directory under jre/lib

I sincerely hope that the Tomcat endorsed directory can do the same.

Jeremy Nicholson, Director of a UK-based Java and Data Warehousing consultancy
 
Thanks for the advice Jeremy, but I think I have found the solution.

My webhoster had added the xalan.jar for me, but I need to have the catalina.policy amended to provide read access to the file. This is because it needs to load properties files from within the jar.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top