You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Rimov <ri...@centercomp.com> on 2002/09/13 22:16:05 UTC

WEB-INF/lib Xerces2 vs. common/lib Xerces 1

Hey All,

I've got a weird class loading problem that I was wondering if somebody 
knew the best workaround:

We're shooting to deliver Xerces 2 with our webapp framework (Expresso)... 
but since Tomcat comes with Xerces 1 in the common/lib, I'm finding a weird 
conflict.  The directory layout is:

	-common/lib/xerces.jar
	-webapps/ROOT/WEB-INF/lib/xercesImpl.jar
	-webapps/ROOT/WEB-INF/lib/xmlapis.jar
	-webapps/ROOT/WEB-INf/lib/xalan.jar

The offending code is as follows:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(false);

DocumentBuilder db = dbf.newDocumentBuilder();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When the last line is called, I get a 'class not found' error, which is 
DOMErrorHandler (Xerces 2 specific).  So obviously, the above code is 
picking up a combination of Xerces 1 jar, and Xerces 2 jar.

So, since we don't want to have every installation out there deleting the 
xerces.jar that comes with Tomcat 4, does anybody have a suggested 
workaround so that we can make sure we're getting the Xerces 2 
DocumentBuilder??

Thanks in advance!!
						-Mike



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: WEB-INF/lib Xerces2 vs. common/lib Xerces 1

Posted by Jean-Francois Arcand <jf...@apache.org>.
If you don't want to update Tomcat, you have two solutions:

(1) If you are using JDK 1.4, add the following in the catalina.bat 
where java is invoked

-Djava.dir.endorsed="location of your Xerces files"

The VM will use by default your Xerces 2 jar file

see: http://java.sun.com/j2se/1.4/docs/guide/standards/

(2) If you are using JDK 1.2 or 1.3

copy your file under {java_home}\jre\lib\ext

That will have the same effect has (1). You may want to move to another 
location the Xerces1 files, just in case (I cannot test this solution)

-- Jeanfrancois

Jacob Kjome wrote:

>Hello Michael,
>
>If you use j2sdk1.4.x, the JDK will override the older xerces with its
>own version.
>
>Otherwise, upgrade to Tomcat-4.1.10 because it uses the latest Xerces
>by default (in common/endorsed).
>
>Jake
>
>Friday, September 13, 2002, 3:16:05 PM, you wrote:
>
>MR> Hey All,
>
>MR> I've got a weird class loading problem that I was wondering if somebody 
>MR> knew the best workaround:
>
>MR> We're shooting to deliver Xerces 2 with our webapp framework (Expresso)... 
>MR> but since Tomcat comes with Xerces 1 in the common/lib, I'm finding a weird 
>MR> conflict.  The directory layout is:
>
>MR>         -common/lib/xerces.jar
>MR>         -webapps/ROOT/WEB-INF/lib/xercesImpl.jar
>MR>         -webapps/ROOT/WEB-INF/lib/xmlapis.jar
>MR>         -webapps/ROOT/WEB-INf/lib/xalan.jar
>
>MR> The offending code is as follows:
>MR> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
>MR> dbf.setNamespaceAware(true);
>MR> dbf.setValidating(false);
>
>MR> DocumentBuilder db = dbf.newDocumentBuilder();
>MR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>MR> When the last line is called, I get a 'class not found' error, which is 
>MR> DOMErrorHandler (Xerces 2 specific).  So obviously, the above code is 
>MR> picking up a combination of Xerces 1 jar, and Xerces 2 jar.
>
>MR> So, since we don't want to have every installation out there deleting the 
>MR> xerces.jar that comes with Tomcat 4, does anybody have a suggested 
>MR> workaround so that we can make sure we're getting the Xerces 2 
>MR> DocumentBuilder??
>
>MR> Thanks in advance!!
>MR>                                                 -Mike
>
>
>
>MR> --
>MR> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>MR> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>  
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: WEB-INF/lib Xerces2 vs. common/lib Xerces 1

Posted by Jacob Kjome <ho...@visi.com>.
Hello Michael,

If you use j2sdk1.4.x, the JDK will override the older xerces with its
own version.

Otherwise, upgrade to Tomcat-4.1.10 because it uses the latest Xerces
by default (in common/endorsed).

Jake

Friday, September 13, 2002, 3:16:05 PM, you wrote:

MR> Hey All,

MR> I've got a weird class loading problem that I was wondering if somebody 
MR> knew the best workaround:

MR> We're shooting to deliver Xerces 2 with our webapp framework (Expresso)... 
MR> but since Tomcat comes with Xerces 1 in the common/lib, I'm finding a weird 
MR> conflict.  The directory layout is:

MR>         -common/lib/xerces.jar
MR>         -webapps/ROOT/WEB-INF/lib/xercesImpl.jar
MR>         -webapps/ROOT/WEB-INF/lib/xmlapis.jar
MR>         -webapps/ROOT/WEB-INf/lib/xalan.jar

MR> The offending code is as follows:
MR> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
MR> dbf.setNamespaceAware(true);
MR> dbf.setValidating(false);

MR> DocumentBuilder db = dbf.newDocumentBuilder();
MR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

MR> When the last line is called, I get a 'class not found' error, which is 
MR> DOMErrorHandler (Xerces 2 specific).  So obviously, the above code is 
MR> picking up a combination of Xerces 1 jar, and Xerces 2 jar.

MR> So, since we don't want to have every installation out there deleting the 
MR> xerces.jar that comes with Tomcat 4, does anybody have a suggested 
MR> workaround so that we can make sure we're getting the Xerces 2 
MR> DocumentBuilder??

MR> Thanks in advance!!
MR>                                                 -Mike



MR> --
MR> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
MR> For additional commands, e-mail: <ma...@jakarta.apache.org>



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>