I'm very interested to hear what Tomcat gurus/commiters think of this
mod.  Given the links that describe the problem, and because I just have
this feeling that classloading issues are so replete with 'good
intentioned, but ultimately doomed architectures'... ya know...  here's
someone that bothered to crack the hood open, found the source of his
difficulties, and fixed them.
 
Does this break something else?

Is it against spec?

Just curious.

> -----Original Message-----
> From: Kruse, Matt [mailto:[EMAIL PROTECTED] 
> Sent: Monday, September 22, 2003 3:52 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Using Digester in a Tomcat project causes server 
> not to start?
> 
> 
> I have solved the problem below. The solution involved 
> changing a couple of the Tomcat source files due to Digester 
> instances not using the correct Classloader upon Tomcat startup.
> 
> The changes I made are as follows:
> 
> 1) in Catalina.java:
> 
>     /**
>      * Create and configure the Digester we will be using for startup.
>      */
>     protected Digester createStartDigester() {
> 
>         // Initialize the digester
>         Digester digester = new Digester();
> +       digester.setClassLoader(this.getClass().getClassLoader());
> 
> 2) in ContextConfig.java:
> 
>     /**
>      * Create (if necessary) and return a Digester configured 
> to process the
>      * web application deployment descriptor (web.xml).
>      */
>     private static Digester createWebDigester() {
> 
>         URL url = null;
>         Digester webDigester = new Digester();
> +       
> + webDigester.setClassLoader(ContextConfig.class.getClassLoader());
> 
> 3) Replace the .class files from the above two files into 
> c:\tomcat\server\lib\Catalina.jar
> 
> That's it! My application now starts up correctly and uses 
> its internal instance of digester doesn't conflict with 
> Tomcat's version.
> 
> And in the process, I've learned a lot about Classloaders :)
> 
> Matt Kruse
> 
> 
> > -----Original Message-----
> > From: Kruse, Matt
> > Sent: Monday, September 22, 2003 11:08 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: Using Digester in a Tomcat project causes server not 
> > to start?
> > 
> > 
> > I know I'm ignorant in some areas of this problem, so please
> > forgive me if I don't explain it well or if I'm missing 
> > something obvious!
> > 
> > PROBLEM: Tomcat won't startup (via Eclipse plugin) when
> > Apache's commons-digester.jar is included as a project lib.
> > 
> > QUESTION: How can I use the Digester in my project with Tomcat?
> > 
> > SEE ALSO (appear to reference the same problem): 
> > http://www.mail-archive.com/[EMAIL PROTECTED]/msg4
> > 5756.html 
> > http://groups.google.com/groups?selm=c09cb3fc.0307290659.57359
> > 042%40posting.google.com 
> > http://www.mail-archive.com/[EMAIL PROTECTED]/ms
> > g02848.html
> > 
> > I've narrowed it down to this being the source of the
> > problem. It looks like it has something to do with 
> > ClassLoaders or something, but I don't know much about that. 
> > I'm confused.
> > 
> > It's a problem that others have apparently encountered. A
> > patch to Catalina may solve the problem, but I haven't seen 
> > any posts or messages detailing a work-around. 
> > 
> > Is there a work-around I can use _NOW_ to make my project
> > work in Tomcat?
> > 
> > Thanks!
> > 
> > Matt Kruse
> > 
> > PS:
> > 
> > This is the error I get when including Digester in the
> > dependencies and trying to start Tomcat:
> > 
> > 2003-09-22 10:22:29,962 0    [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no
> > namespace URI
> > 2003-09-22 10:22:29,978 16   [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no 
> > namespace URI
> > 2003-09-22 10:22:29,978 16   [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no 
> > namespace URI
> > 2003-09-22 10:22:29,993 31   [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no 
> > namespace URI
> > 2003-09-22 10:22:29,993 31   [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no 
> > namespace URI
> > 2003-09-22 10:22:29,993 31   [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no 
> > namespace URI
> > 2003-09-22 10:22:29,993 31   [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no 
> > namespace URI
> > 2003-09-22 10:22:29,993 31   [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no 
> > namespace URI
> > 2003-09-22 10:22:29,993 31   [main] DEBUG 
> > org.apache.commons.digester.Digester  - addRuleSet() with no 
> > namespace URI
> > 2003-09-22 10:22:30,071 109  [main] DEBUG 
> > org.apache.commons.digester.Digester.sax  - 
> > setDocumentLocator(org.apache.xerces.parsers.AbstractSAXParser
> > [EMAIL PROTECTED])
> > 2003-09-22 10:22:30,071 109  [main] DEBUG 
> > org.apache.commons.digester.Digester.sax  - startDocument()
> > 2003-09-22 10:22:30,103 141  [main] DEBUG 
> > org.apache.commons.digester.Digester.sax  - 
> > startPrefixMapping(xml,http://www.w3.org/XML/1998/namespace)
> > 2003-09-22 10:22:30,103 141  [main] DEBUG 
> > org.apache.commons.digester.Digester.sax  - 
> > startPrefixMapping(xmlns,http://www.w3.org/2000/xmlns/)
> > 2003-09-22 10:22:30,103 141  [main] DEBUG 
> > org.apache.commons.digester.Digester.sax  - startElement(,,Server)
> > 2003-09-22 10:22:30,103 141  [main] DEBUG 
> > org.apache.commons.digester.Digester  -   Pushing body text ''
> > 2003-09-22 10:22:30,103 141  [main] DEBUG 
> > org.apache.commons.digester.Digester  -   New match='Server'
> > 2003-09-22 10:22:30,103 141  [main] DEBUG 
> > org.apache.commons.digester.Digester  -   Fire begin() for 
> > ObjectCreateRule[className=org.apache.catalina.core.StandardSe
> > rver, attributeName=className]
> > 2003-09-22 10:22:30,103 141  [main] DEBUG 
> > org.apache.commons.digester.Digester  - 
> > [ObjectCreateRule]{Server}New 
> org.apache.catalina.core.StandardServer
> > 2003-09-22 10:22:30,103 141  [main] ERROR 
> > org.apache.commons.digester.Digester  - Begin event threw exception
> > java.lang.ClassNotFoundException: 
> > org.apache.catalina.core.StandardServer
> > at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
> > at 
> > org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreat
> > eRule.java:252)
> > at org.apache.commons.digester.Rule.begin(Rule.java:200)
> > at 
> > 
> org.apache.commons.digester.Digester.startElement(Digester.java:1268)
> > at 
> > org.apache.xerces.parsers.AbstractSAXParser.startElement(Unkno
> > wn Source)
> > at 
> > org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknow
> > n Source)
> > at 
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStar
> > tElement(Unknown Source)
> > at 
> > org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatche
> > r.scanRootElementHook(Unknown Source)
> > at 
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragment
> > ContentDispatcher.dispatch(Unknown Source)
> > at 
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocu
> > ment(Unknown Source)
> > at 
> org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> > at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> > at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> > at org.apache.commons.digester.Digester.parse(Digester.java:1543)
> > at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
> > at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
> > at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at 
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> > orImpl.java:39)
> > at 
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > odAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:324)
> > at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
> > Catalina.start: java.lang.ClassNotFoundException: 
> > org.apache.catalina.core.StandardServer
> > java.lang.ClassNotFoundException: 
> > org.apache.catalina.core.StandardServer
> > at 
> > org.apache.commons.digester.Digester.createSAXException(Digest
> > er.java:2383)
> > at 
> > org.apache.commons.digester.Digester.createSAXException(Digest
> > er.java:2409)
> > at 
> > 
> org.apache.commons.digester.Digester.startElement(Digester.java:1271)
> > at 
> > org.apache.xerces.parsers.AbstractSAXParser.startElement(Unkno
> > wn Source)
> > at 
> > org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknow
> > n Source)
> > at 
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStar
> > tElement(Unknown Source)
> > at 
> > org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatche
> > r.scanRootElementHook(Unknown Source)
> > at 
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragment
> > ContentDispatcher.dispatch(Unknown Source)
> > at 
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocu
> > ment(Unknown Source)
> > at 
> org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> > at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> > at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> > at org.apache.commons.digester.Digester.parse(Digester.java:1543)
> > at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
> > at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
> > at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at 
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> > orImpl.java:39)
> > at 
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > odAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:324)
> > at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
> > 
> > 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to