You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dave Makower <da...@mac.com> on 2002/03/08 23:27:09 UTC

Tomcat 4.0.3 ClassLoader Problem

My app used to work on Tomcat 4.0.1, but now I get a
java.lang.NoClassDefFoundError whenever the application tries to use one of
our custom tags: in particular, it's a tag that uses XSLT transformations.
The class that is not found is
javax.xml.transform.TransformerConfigurationException, which is located in
the xml-apis.jar file, located in our webapp's WEB-INF/lib directory.  This
file came with Xalan.

I've attached a stack trace below.  Notice that the error happens in
introspecting on the Tag bean.  From this I infer that whatever class is
introspecting on the bean was loaded by a ClassLoader that does not have
visibility to classes loaded from the webapp's WEB-INF/lib directory.  (Can
someone confirm this?)

Is this a bug or a feature?  Can anyone confirm that my analysis above is
correct, or else explain where I've failed to analyze the situation
properly?  Does anyone have any suggestions as to how I can fix this
problem?

Now, it's possible that I could work around this problem by moving
xerces.jar out of catalina's common/lib directory, as described by the
release notes (as a way of preventing Tomcat from providing an XML parser to
all webapps).  But this would require everyone installing the app to modify
their tomcat installation, and I want our webapp to work with a vanilla
tomcat installation, out of the box.

---------------------------

Stack trace:

java.lang.NoClassDefFoundError:
javax/xml/transform/TransformerConfigurationException
        at java.lang.Class.getMethods0(Native Method)
        at java.lang.Class.getDeclaredMethods(Class.java:1039)
        at java.beans.Introspector$1.run(Introspector.java:852)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:850)
        at java.beans.Introspector.getTargetEventInfo(Introspector.java:556)
        at java.beans.Introspector.getBeanInfo(Introspector.java:294)
        at java.beans.Introspector.getBeanInfo(Introspector.java:81)
        at 
org.apache.jasper.compiler.TagCache.setTagHandlerClass(TagCache.java:116)
        at 
org.apache.jasper.compiler.TagBeginGenerator.init(TagBeginGenerator.java:146
)
        at 
org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.init(JspPa
rseEventListener.java:822)
        at 
org.apache.jasper.compiler.JspParseEventListener.addGenerator(JspParseEventL
istener.java:151)
        at 
org.apache.jasper.compiler.JspParseEventListener.handleTagBegin(JspParseEven
tListener.java:1032)
        at 
org.apache.jasper.compiler.DelegatingListener.handleTagBegin(DelegatingListe
ner.java:217)
        at 
org.apache.jasper.compiler.DelegatingListener.handleTagBegin(DelegatingListe
ner.java:212)
        at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:878)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:1145)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:1103)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:1099)
        at 
org.apache.jasper.compiler.ParserController.parse(ParserController.java:213)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:210)
        at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:552)
        at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:177)
        at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:189)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


-- 
+-------------------------------------------------------------------+
| Dave Makower                        <da...@mac.com>             |
| http://www.davemak.com/                                           |
+-------------------------------------------------------------------+



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Tomcat 4.0.3 ClassLoader Problem

Posted by Remy Maucherat <re...@apache.org>.
> My app used to work on Tomcat 4.0.1, but now I get a
> java.lang.NoClassDefFoundError whenever the application tries to use one
of
> our custom tags: in particular, it's a tag that uses XSLT transformations.
> The class that is not found is
> javax.xml.transform.TransformerConfigurationException, which is located in
> the xml-apis.jar file, located in our webapp's WEB-INF/lib directory.
This
> file came with Xalan.

Yes, it's a well known issue.

> I've attached a stack trace below.  Notice that the error happens in
> introspecting on the Tag bean.  From this I infer that whatever class is
> introspecting on the bean was loaded by a ClassLoader that does not have
> visibility to classes loaded from the webapp's WEB-INF/lib directory.
(Can
> someone confirm this?)
>
> Is this a bug or a feature?  Can anyone confirm that my analysis above is
> correct, or else explain where I've failed to analyze the situation
> properly?  Does anyone have any suggestions as to how I can fix this
> problem?

That's a feature gone wrong. Sorry for the trouble ...
Move Xalan to common/lib, or upgrade to 4.0.4-b1.

Remy


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>