Updating and Using the JAXP JAR Files
with JWSDP, Tomcat, and the J2SE Platform

Contents

Introduction

If you are installing or updating the full Java Web Services Developer Pack (Java WSDP), and you will be using the ant script processor that comes with that package, there are no other configuration steps you need to take. The installation/update/scripting process takes care of the details for you.

On the other hand, you'll need to follow the instructions below if:

  • You are using JAXP by itself with the Java 2 platform, or
  • You don't use ant, or
  • You use a different version of ant than the one bundled with the JWSDP package

Note:
The JWSDP version of ant automatically sets a system property that points to its lib/common directory for endorsed libraries. That step helps to eliminate the problem of incompatible libraries that may be left over from previous installs. However, it also means that libraries which have been added to <JAVA_HOME>/lib/endorsed are not automatically seen when the JWSDP version of ant runs.

Updating the JAR Files

When you download a technology that includes JAXP, like the Java Web Services Developer Pack, the JAXP JAR files are found with the other JARS that are included as part of that technology release. (See the release notes that accompany the technology, for the specific location.)

However, it is sometimes desirable to obtain updated versions of the JAR files individually. The remainder of this section tells you where and how.

Apache Implementation JAR Files

Three of the JAR files contain Apache implementations of the parser and transformation classes:

  • xercesImpl.jar
  • xalan.jar
  • xsltc.jar

The most recently updated versions of those JAR files can be obtained from

JAR Files for the Parsing APIs

While the implementation jar files correspond to the Apache release, there is a difference in the packaging of the API jar files. The single Apache jar file, xml-apis.jar, is broken up into 3 jar files in JAXP: jaxp-api.jar, sax.jar, dom.jar.

The SAX and DOM APIs are in separate JAR files because they are "endorsed standards" that are built into version 1.4 of the Java platform. That means newer versions of those JAR files can be placed in the endorsed standards directory to update those APIs. (For more information on the SDK's endorsed standards mechanism, see http://java.sun.com/j2se/1.4/docs/guide/standards/.)

Since the packages contained in the jaxp-api.jar file are not endorsed standards (and cannot be placed in the endorsed standards directory), they exist in a separate jar file.

Note:
The Apache API jar file also contains Apache-specific APIs. These are not present in the JAXP release, as they are not integral to the Java APIs for XML Processing (JAXP).

The JAR files that define the SAX and DOM API classes used by the parsers and transformation engines are:
  • sax.jar (SAX 2.0)
  • dom.jar (Dom Level 2)

If you upgrade to a version of the parser that uses a different version of those APIs, you would need to replace the JAR file containing the appropriate API. For more information on those APIs, see:

JAR file for the JAXP APIs

The remaining JAR file defines the JAXP factory classes and transform APIs:

  • jaxp-api.jar

As of version 1.4, those classes are built into the Java 2 platform. Because they are high-level wrapper classes that are not subject to change, it is not necessary to do anything with that JAR file when using Java 1.4. For earlier versions of the Java 2 platform, it always accompanies the other JAR files.

Using the JAR Files

This section tells you what to do with the JAR files, depending on the configuration in which they are being used. The relevant variables are:

  • Whether or not you are using the Java Web Services Developer Pack
  • Whether or not you are using Tomcat
  • Whether you are using version 1.4 of the Java 2 platform, or an earlier version

Using JAXP with the Java Web Services Developer Pack (JWSDP)

Again, if you are using the Java WSDP installation process to do the update, then you don't have to worry about the updates. But if you are updating individual jar files, copy them to

<JWSDP_HOME>/common/endorsed/

Using JAXP with Tomcat version 4.0.3 or 3.3

First, be sure to remove xerces.jar from

<TOMCAT_HOME>/common/lib/

The reason for that step is that xerces.jar contains earlier Xerces implementations which will interfere with the operation of JAXP 1.2.

The next step depends on which version of the Java 2 SDK you are using:

Then, for version 1.4 of the Java 2 SDK:
You need to know that JAXP 1.1 is built into that version of the platform. JAXP 1.1 has a smaller footprint, but JAXP 1.2 implements XML Schema, and it also includes transform compiler, XSLTC.

To use the JAXP 1.2 implementation instead of the JAXP 1.1 implementation, copy all of the JAR files except jaxp-api.jar to

<TOMCAT_HOME>/common/lib/

Note:

The jaxp-api.jar file should not be copied, because it contains high-level factory APIs that are already part of the 1.4 platform and which are not subject to change. This file is only present for use on platform versions prior to 1.4. Users of 1.4 and later platforms should ignore it.

Then, when running Tomcat, set the java.endorsed.dirs system property to

<TOMCAT_HOME>/common/lib/
 
Or, for version 1.3 of the Java 2 SDK:
Copy all the JAR files to

<TOMCAT_HOME>/common/lib/

and add that directory to your classpath.

Using JAXP with version 1.4 of the Java 2 platform

Version 1.4 of the Java 2 platform has a JAXP 1.1 implementation built in. (JAXP 1.1 has a smaller application footprint, but JAXP 1.2 implements XML Schema and the transform compiler, XSLTC.) Because the built-in libraries are accessed before any classpath entries, you can only access the updated libraries by using the Java platform's Endorsed Standards mechanism.

There are two ways to use the endorsed standards mechanism. The first way is to copy all of the jar files except jaxp-api.jar into

 <JAVA_HOME>/jre/lib/endorsed/

Note:
The jaxp-api.jar file should not be copied, because it contains high-level factory APIs that are not subject to change.

Alternatively, you can use the java.endorsed.dirs system property to dynamically add those jar files to the JVM when you start your program. Using that system property gives you flexibility of using different implementations for different applications.  You specify that property using

-Djava.endorsed.dirs=yourDirectoryPath.

Finally, although the endorsed directory mechanism guarantees that the specified jars will be searched before the internal classes in the VM (which are searched before the classpath), the order in which the jar files are searched is indeterminate. For that reason, there should be no overlaps in the classes specified using that property. For more information, see the Endorsed Standards documentation for the 1.4 version of the Java platform.

 
Terms of Use; Privacy Policy; Copyright ©2013-2014 (revision 20140418.2d69abc)
 
 
Close
loading
Please Confirm
Close