tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Webapp specific endorsed dir?
Date Sun, 12 Jan 2003 08:29:41 GMT

It violates the Sun classloading spec to load endorsed classes from 
WEB-INF/lib or WEB-INF/classes.  There are a number of bugs that have been 
filed on this and the conclusion of all of them is that Tomcat simply won't 
support any sort of overriding of XML or DOM libraries from the webapp 
classloader.  If you want to override jdk1.4.x endorsed packages, you must 
use common/endorsed.  If you just want to use specific xerces classes, you 
can remove them from common/endorsed (and make sure they don't exist in 
common/lib). Then, create a separate instance of Tomcat using CATALINA_BASE 
and create a CATALINA_BASE/shared/lib directory.  Put your xerces jar there 
and your app will use your custom version of Xerces rather than any default 
ones that Tomcat provides.

That is the only way I know to use a specific version of xerces 
per/app.  Of course you can always just replace Tomcat's version of xerces 
with yours and force all apps to your yours by putting it in common/endorsed.

Jake

At 06:47 PM 1/11/2003 -0800, you wrote:
>Hi all,
>
>Is there a way for webapps to declare jars that can override jars in 
>Tomcat's common/endorsed directory?  For example, if I want to my webapp 
>to use a specific version of Xerces, independent of what gets distributed 
>with Tomcat, what do I have to do?  Right now, with Tomcat 4.1.18, if I 
>have a copy of xercesImpl.jar in /WEB-INF/lib I get:
>
>Exception during startup processing
>java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
>Caused by: java.lang.VerifyError: Cannot inherit from final class
>         at java.lang.ClassLoader.defineClass0(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
>         at 
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
>         at 
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1664)
>         at 
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:953)
>         at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1394)
>         at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1274)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
>         at 
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.createContentDispatcher(Unknown 
> Source)
>         at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.<init>(XMLDocumentFragmentScannerImpl.java:249)
>         at 
> org.apache.xerces.impl.XMLDocumentScannerImpl.<init>(XMLDocumentScannerImpl.java:245)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.<init>(Unknown 
> Source)
>         at 
> org.apache.xerces.parsers.IntegratedParserConfiguration.createDocumentScanner(Unknown

> Source)
>         at 
> org.apache.xerces.parsers.DTDConfiguration.<init>(DTDConfiguration.java:367)
>         at 
> org.apache.xerces.parsers.StandardParserConfiguration.<init>(StandardParserConfiguration.java:198)
>         at 
> org.apache.xerces.parsers.IntegratedParserConfiguration.<init>(Unknown Source)
>         at 
> org.apache.xerces.parsers.IntegratedParserConfiguration.<init>(Unknown Source)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
>         at java.lang.Class.newInstance0(Class.java:296)
>         at java.lang.Class.newInstance(Class.java:249)
>         at 
> org.apache.xerces.util.ObjectFactory.newInstance(ObjectFactory.java:266)
>         at 
> org.apache.xerces.util.ObjectFactory.findJarServiceProvider(ObjectFactory.java:360)
>         at 
> org.apache.xerces.util.ObjectFactory.createObject(ObjectFactory.java:185)
>         at 
> org.apache.xerces.util.ObjectFactory.createObject(ObjectFactory.java:120)
>         at org.apache.xerces.parsers.SAXParser.<init>(SAXParser.java:140)
>         at org.apache.xerces.parsers.SAXParser.<init>(SAXParser.java:125)
>         at 
> org.apache.xerces.jaxp.SAXParserImpl.<init>(SAXParserImpl.java:102)
>         at 
> org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:95)
>         at org.apache.commons.digester.Digester.getParser(Digester.java:676)
>         at 
> org.apache.commons.digester.Digester.getXMLReader(Digester.java:892)
>         at org.apache.commons.digester.Digester.parse(Digester.java:1495)
>         at 
> org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:548)
>         at 
> org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:638)
>         at 
> org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:243)
>         at 
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
>         at 
> org.apache.catalina.core.StandardContext.start(StandardContext.java:3567)
>         at 
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
>         at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
>         at 
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
>         at 
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
>         at 
> org.apache.catalina.core.StandardService.start(StandardService.java:497)
>         at 
> org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
>         at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
>         at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
>         ... 5 more
>
>
>Any help on this would be greatly appreciated.  Please cc: me in when 
>responding since I'm not subscribed to the tomcat-user mailing list.
>
>Thanks,
>-Mark
>
>P/S - it would have been a great help if the error message included which 
>jarfile it was barfing on!
>
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message