Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

Maven works great and solves lots of conflicting API problems for you.  The one case when it can’t help and usually hurts is when APIs change groupId or artifactId.  I recently had a case where I needed a CXF generated client to log the outbound and inbound soap messages. I added the following to my client spring config file.

<cxf:bus>
    <cxf:features>
        <cxf:logging/>
    </cxf:features>
 </cxf:bus>

This worked great in the small test app that I wrote.  It was an epic fail when I added it to my much larger webapp.

The problem was that the Xerces api that it was finding wasn’t the same version that it thought it was calling.

After much searching, I found Xerces and xml-api Dependency Hell.  This blog went into the history of the various names.  The gist is that now, you use xml-apis:xml-apis for your Maven XML dependency.  You may also have to exclude xerces:xmlParserAPIs and xml-apis:xmlParserAPIs.

While researching this, I ran across Using the EnvironmentCheck utility that can help diagnose XML API classpath problems.

March 1st, 2012

Posted In: Java, xml

One Comment

  • Clint Stivers says:

    Making the JAXP implementation was SUPPOSED to make XML processing in Java easier. It has made the simple problem FAR more difficult than it needed to be though. Ruby and Flex got XML processing right. I’ve had more headaches with JAXP configuration than any other configurable feature of Java.

Leave a Reply

Your email address will not be published. Required fields are marked *

WP to LinkedIn Auto Publish Powered By : XYZScripts.com