tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Flanagan <da...@oreilly.com>
Subject can't use tag libraries with tomcat 3.0
Date Tue, 04 Jan 2000 18:33:08 GMT

When I try to run the taglibrary examples with tomcat 3.0 on my Redhat
3.1 box and Java 1.2.2 rc1 from Sun I get the following:

    Unhandled error! You might want to consider having an error page to report
    such errors more gracefully
    java.lang.IllegalAccessError: try to access class
    com/sun/xml/tree/ParentNode from class
    org/apache/jasper/compiler/TagLibraryInfoImpl at
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:155)
at
    org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve

The relevant line in TagLibraryInfoImpl.java is:

     XmlDocument webtld = JspUtil.parseXMLDoc(is, dtdURL,
                                           Constants.WEBAPP_DTD_PUBLIC_ID);

An com.sun.xml.tree.XmlDocument is a public subclass of the
package-private class ParentNode, which is itself a subclass of the
package-private class NodeBase.  If I'm understanding this bug right,
the access error occurs because although XmlDocument is public, its
superclasses are not, and therefore it is effectively not public.

I haven't checked the spec, so I don't know if this is expected
behavior.  Perhaps it is a bug in my implementation of Java, which seems
more plausible then the alternative, which would seem to be that
XmlDocument is entirely unusable.  (Another thought: does Tomcat do
anything fancy with class loaders?  Could this be causing the problem?)

In any case, I suspect the workaround is to modify Sun's parser classes
and make ParentNode and NodeBase public.  Both classes contain this
comment:

    // not public ... javadoc looks a bit odd (hidden base class)
    // but it's only subclassable within this package anyway

which indicates to me that the author realized he was doing something
weird, but thought he could get away with it...  I'd hate to have to
change code that comes all nicely pre-packaged from Sun.  I don't know
what else to do, though.

Any hints, comments, or solutions are quite welcome.  I've tried to
subscribe to this list, but appear to have failed.  Is there a human or
a machine on the other end of tomcat-dev-subscribe@jakarta.apache.org?
Do I need to put anything special in the subject line or the body of the
message?

Thanks,

	David Flanagan

Mime
View raw message