> It (the JSP servlet) is loaded early already.
>
> It (and its XML parser) are now loaded by another classloader (not sure
> that was
> true on the 22nd -- if your Tomcat 4.0 has "jasper-compiler.jar" and
> "jasper-runtime.jar" separated, then it is for you).

I have jasper-compiler.jar in 'jasper' and jasper-runtime.jar in 'lib'
>
> The problem is the following scenario:
>
> * JSP servlet loads early, parses TLDs from the web.xml file (which
>   causes some JAXP parser classes to be loaded).
>
> * You do something with Xerces that causes Xerces classes to
>   be loaded, from your webapps class loader (parent of the one
>   used by the JSP servlet).
>
> * You do something with a JSP page that causes more parser
>   classes to be loaded (from the JSP servlet's classloader), including
>   a class with the same fully qualified name as one of the Xerces
>   classes you just loaded.
>
> * Under 1.2 this worked.  Under 1.3 it gives sealing violation errors
>

I'm not seeing this sequence (I don't think)

* I'm loading Xerces in my listener (in fact all I'm doing is using the
DocumentBuilder and DocumentBuilderFactory), in the contextInitialized
method, this is getting loaded first.

* JSP servlet is trying to load - in it's init() method I get the exception

No TLDs but I see a call to TldLocationsCache.<init>

This is part of the trace I'm seeing

ContextConfig[/KRJ]: Added certificates -> request attribute Valve
xmlSetupListener: enter contextInitialized
xmlSetupListener: leave contextInitialized
StandardWrapper[/KRJ:default]: Loading container servlet default
default: init
StandardWrapper[/KRJ:invoker]: Loading container servlet invoker
invoker: init
StandardWrapper[/KRJ:jsp]: Using Jasper classloader for servlet jsp
jsp: init
StandardContext[/KRJ]: Servlet /KRJ threw load() exception
javax.servlet.ServletException: Servlet.init() for servlet jsp threw
exception
        at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:791)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3135)

... lines omitted for brevity ...

----- Root Cause -----
java.lang.SecurityException: sealing violation
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:234)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at
org.apache.catalina.loader.StandardClassLoader.findClass(StandardClassLoader
.java:646)
        at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
.java:1013)
        at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
.java:912)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
        at
org.apache.jasper.compiler.TldLocationsCache.processWebDotXml(TldLocationsCa
che.java:161)


> The only other possible workaround I can think if is to exhaustively
> load every
> single class file out of jaxp.jar and crimson.jar at startup time.  That
> seems
> horrendously wasteful of memory (especially when you consider that this
> has to
> be done for each web app).
>

Agreed

Kevin Jones
DevelopMentor
www.develop.com


Reply via email to