Tony,

have you seen

http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

In general, implementing classloader hierarchies, as the one in tomcat
5.5, is not a simple matter.

Citing from those pages:
"As mentioned above, the web application class loader diverges from
the default Java 2 delegation model (in accordance with the
recommendations in the Servlet Specification, version 2.3, section
9.7.2 Web Application Classloader)"

Thus sometimes there are issues.

Even there may be bugs somewhere.

As for XML parsing:
My speculation is that the XML parsing library registers itself as
JAXP parser in the JVM, for the whole JVM, for the whole server. Thus,
wrecking the configuration. Because it cannot be used outside of the
web app.

> However, that does not clarify for me why it
> only happens when I attempt to set the <load-on-startup> element in the
> webapps web.xml file but if I do not autoload the class, it works just
> fine.

It runs fine just until there is a need to parse xml files somewhere
outside of your web app. At the moment this parsing happens (sooner or
later, as there are a plenty of configuration files), you will
encounter the issue.  E.g. try to deploy a second war file, and you
may see the issue.

Placing the parser jar into common/lib does work, if you consider the
classloaders hierarchy.

Nevertheless, the official path to provide a custom XML parsing
library is to use the endorsing mechanism. See "XML Parsers and J2SE
1.4", "XML Parsers and JSE 5" chapters in class-loader-howto.html

Chuck wrote:
> I'm not sure if there's any means of specifying a webapp-local XML
> parser rather than a global one; others may have more experience here.

Best regards,
- Konstantin.

2007/10/26, Tony Fountain <[EMAIL PROTECTED]>:
> Thanks for the response.  However, that does not clarify for me why it
> only happens when I attempt to set the <load-on-startup> element in the
> webapps web.xml file but if I do not autoload the class, it works just
> fine.  As far as the JAVA_OPTS go, I do not see where I have this set at
> all.  I'm running Apache Tomcat 5.5.23 as a windows service.  In the
> properties under Java, I am setting these options:
>
> -Dcatalina.home=C:\Apache\Tomcat
> -Dcatalina.base=C:\Apache\Tomcat
> -Djava.endorsed.dirs=C:\Apache\Tomcat\common\endorsed
> -Djava.io.tmpdir=C:\Apache\Tomcat\temp
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> -Djava.util.logging.config.file=C:\Apache\Tomcat\conf\logging.properties
>
> Thanks,
> Tony
>
> -----Original Message-----
> From: Caldarale, Charles R [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 26, 2007 12:18 PM
> To: Tomcat Users List
> Subject: RE: Class loading issue
>
> > From: Tony Fountain [mailto:[EMAIL PROTECTED]
> > Subject: RE: Class loading issue
> >
> > Caused by: javax.xml.parsers.FactoryConfigurationError: Provider
> > org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
>
> It looks like you must have the system property
> javax.xml.parsers.DocumentBuilderFactory set to point to
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl (e.g., via JAVA_OPTS).
> This forces all XML scanning to go through that class, including any
> done by Tomcat itself.  Consequently, the above class must be made
> visible to the Tomcat internal classes, so putting the jar into
> common/lib is required.
>
> I'm not sure if there's any means of specifying a webapp-local XML
> parser rather than a global one; others may have more experience here.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to