Coding in Color

February 17, 2010

UnsupportedOperationException and XML Parser versions

I lost a day struggling with this Java error. I had been trying to parse a XML document in a Java web application. It had worked in previous deployments so I knew the code was sound. But when I deployed the WAR file onto my Tomcat6 server on Ubuntu Linux 9.10 I hit an obscure error I had not encountered before.

Apache Commons Digester was throwing an error when it tried to load a XML parser.

java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
	at javax.xml.parsers.SAXParserFactory.setXIncludeAware(SAXParserFactory.java:448)
	at org.apache.commons.digester.Digester.getFactory(Digester.java:534)

This caused another exception in turn:

Digester.getParser:
NullPointerException

I tried everything: switching parsers from xerces to crimson; running tomcat with different JVMs; overriding classloaders; all to no avail. Finally I came upon a blog post which revealed that “[the] message This parser does not support specification “null” version “null” [is] the secret. That’s the default error message of the XML parser if you turn on XInclude but that isn’t a supported feature.”

The reason for the UnsupportedOperationException error was that the XML parser implementation I was using did not support the features Commons Digester was trying to set on it. I upgraded my version of xercesImpl.jar from 2.6.2 to 2.9.1, restarted tomcat, and the problem was solved!

Advertisements

15 Comments »

  1. This is exactly the same error I got. Your posting helped me much. thanks for saving my day!

    Comment by Satish — March 5, 2010 @ 7:38 pm

  2. Thank you for your blog entry, and even more for the concise statement of “I upgraded my version of xercesImpl.jar from 2.6.2 to 2.9.1”. This was exactly what I have been looking for, and has solved my problem.

    Comment by Eric Enright — May 8, 2010 @ 5:49 am

  3. Your posting helped me much… God bless you…

    Comment by Deepak kumar modi — May 14, 2010 @ 9:52 am

  4. Same problem!! same solution!!!

    Comment by Mario García — March 1, 2011 @ 10:48 pm

  5. Thank you ! This concise note regarding the problem and it’s solution helped me at a critical testing phase of my work!

    Comment by aks — June 14, 2011 @ 11:19 pm

  6. very usefull post, thanks

    Comment by v — November 11, 2011 @ 6:19 am

  7. Hey thank U so much…. perfectly worked for me….

    Comment by Naresh — June 4, 2012 @ 6:03 am

  8. Thank you so much… it worked for me too

    Comment by anonymous — November 20, 2012 @ 6:51 am

  9. Thank you …………..this post is very usefull……………….

    Comment by Alankar — January 11, 2013 @ 6:26 am

  10. One more link I’ve just found on this topic:
    https://coderwall.com/p/kqsrrw

    Comment by Odo — January 28, 2013 @ 1:20 pm

  11. thanks! solved the issue

    Comment by endeios — February 18, 2013 @ 2:35 pm

  12. THANK YOU!! Thought I was going mad

    Comment by Carmen — November 27, 2013 @ 9:34 pm

  13. THANK YOU!!!! That saved my day!

    Comment by nauni77 — November 1, 2014 @ 8:04 pm

  14. THANK YOU!! Save me a lot of time

    Comment by Alexandre Chatiron — April 13, 2015 @ 5:23 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: