Search code examples
javaxercesibm-sbtxerces2-j

IBM SBT SDK 1.1.0 (Java) and Apache xerces


I am adding IC integration with IBM SBT SDK (Java) into an existing project which still uses xerces 2.4.0 (as of March 2009).

Using IBM SBT SDK 1.0.x did not cause any problems here, but the XML serialization implementation of 1.1.0 completely relies on org.w3c.xml.ls.DOMImplementationLS and such stuff which was introduced after moving xerces to "xercesImpl" about 2004.

However the project contains much code working with XML based on xerces and xml-apis, and it looks dangerous to move too fast to "more current" versions of these libraries. Thus I want to move "no further than absolutely required".

Thanks to maven no one can directly see which version of any artifact is loaded if it is not directly referenced in the pom.xml. Thus my question:

Which version of xercesImpl is "really" required by IBM SBT SDK 1.1.0? 2.4.0 is not sufficient, as some methods used in the SBT SDK are not yet implemented there...


Solution

  • xerces version in the dependency would be 2.9.0; looking at the DOMUtil.java#loadDriver() class however there are workarounds to avoid the SBTK to use xerces altogether:

    if your container allows to control the classpath tree, shadowing the xerces library from the toolkit will have it default to some other driver. In alternative you can provide your own XercesDriver class compatible with old xerces versions and leverage the classloader to have it loaded in place of ours.

    if you are in a osgi container you can also make sure the host application manifest declares a dependency to a version <=2.4.0 and load both xerces versions letting the container fix the dependencies for you

    anyway, to answer the question, using:

    mvn dependency:list
    

    I get version 2.9.0 for xerces:

     The following files have been resolved:
        com.ibm.sbt:com.ibm.commons:eclipse-plugin:9.0.0:provided
        p2.eclipse-plugin:javax.servlet:jar:3.0.0.v201112011016:system
        p2.eclipse-plugin:javax.xml:jar:1.3.4.v201005080400:system
        p2.eclipse-plugin:org.apache.xalan:jar:2.7.1.v201005080400:system
        p2.eclipse-plugin:org.apache.xerces:jar:2.9.0.v201101211617:system
        p2.eclipse-plugin:org.apache.xml.resolver:jar:1.2.0.v201005080400:system
        p2.eclipse-plugin:org.apache.xml.serializer:jar:2.7.1.v201005080400:system
        p2.eclipse-plugin:org.eclipse.core.contenttype:jar:3.4.200.v20120523-2004:system
        p2.eclipse-plugin:org.eclipse.core.jobs:jar:3.5.300.v20120912-155018:system
        p2.eclipse-plugin:org.eclipse.core.runtime:jar:3.8.0.v20120912-155025:system
        p2.eclipse-plugin:org.eclipse.equinox.app:jar:1.3.100.v20120522-1841:system
        p2.eclipse-plugin:org.eclipse.equinox.common:jar:3.6.100.v20120522-1841:system
        p2.eclipse-plugin:org.eclipse.equinox.preferences:jar:3.5.1.v20121031-182809:system
        p2.eclipse-plugin:org.eclipse.equinox.registry:jar:3.5.200.v20120522-1841:system
        p2.eclipse-plugin:org.eclipse.osgi:jar:3.8.2.v20130124-134944:system