14compatibility.jar in Apple JDK 1.5

A while ago, I came across a weird issue while running the unit tests for Spring-WS. Some of my tests would run perfectly fine on both Windows and Linux, but would not run on Mac OS X.

After some investigation, I came across the /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/.compatibility/14compatibility.jar on my classpath. It contains the following:

    0 Mon Jan 16 14:21:08 CET 2006 META-INF/
    70 Mon Jan 16 14:21:08 CET 2006 META-INF/MANIFEST.MF
     0 Mon Jan 16 14:20:58 CET 2006 org/
     0 Mon Jan 16 14:20:58 CET 2006 org/apache/
     0 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/
     0 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/jaxp/
  1489 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/jaxp/DefaultValidationErrorHandler.class
   912 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/jaxp/DocumentBuilderFactoryImpl.class
  3494 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/jaxp/DocumentBuilderImpl.class
  1671 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/jaxp/SAXParserFactoryImpl.class
  2550 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/jaxp/SAXParserImpl.class
     0 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/
   895 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/AttributeDecl.class
   287 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/AttributesEx.class
  1557 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/AttributesExImpl.class
  1826 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/ContentModel.class
  1959 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/ContentModelState.class
   668 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/ElementDecl.class
   606 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/ElementValidator.class
   241 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/EndOfInputException.class
   306 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/EntityDecl.class
   933 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/ExternalEntity.class
 11395 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/InputEntity.class
   363 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/InternalEntity.class
   603 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/Parser2$1.class
   602 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/Parser2$2.class
   604 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/Parser2$3.class
  1105 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/Parser2$4.class
   542 Mon Jan 16 14:20:58 CET 2006 org/apache/crimson/parser/Parser2$Catalog.class
...

The Crimson XML parser! And the jar contains a version of Xalan as well.

No wonder my XML namespace tests failed: instead of using Xerces, which is part of JDK 1.5, it used Crimson! And the fact that the JAXP libraries in JDK 1.4 used the org.apache.* package makes it pretty hard to override them with your own version. Luckily, this was fixed in JDK 1.5, where Xerces was included in the com.sun.org.apache.xerces package.

I deleted the 14compatibility.jar, and the tests ran fine again. I have no idea what the goal of this jar is, but in my opinion, Apple should get rid of it. JDK 1.4 uses Crimson as a JAXP implementation, and JDK 1.5 uses Xerces. No need for a compatibility jar.

1 Comment

  1. Steve Loughran said,

    September 24, 2006 @ 22:41

    Your app should be checking for the existence of Crimson on startup and bailing out if it finds it. If you look at the source of happyaxis.jsp, you can see how it uses the classname of the allocated jaxp parser as a check.

RSS feed for comments on this post