[jdom-interest] java.lang.NoSuchMethodError: org.xml.sax.Attributes: method getQName(I)Ljava/lang/String; not found

Paul Libbrecht paul at ags.uni-sb.de
Sat Feb 10 22:41:25 PST 2001

At 21:45 -0500 10/02/01, Chris Todd wrote:
>I am trying to work with the Ant "Anakia" task that comes with Velocity, by
>Jon Stevens, but I am getting an error that I think might be a JDOM/xerces
>problem.  I have pasted the stack trace below.  The only jars in my
>classpath were the ant-1.2.jar, jdom.jar, and xerces.jar that came with the
>JDOM-b5 distribution, and velocity-0.71.jar.
>I am not a Java or XML expert, but there are two things that puzzle me about
>the stack trace below.  First, org.xml.sax.Attributes that comes with xerces
>does, in fact, have a method getQName that takes an int and returns a
>String.  Second, org.xml.sax.Attributes is an interface, so it shouldn't
>have an implementation, but org.jdom.input.SAXHandler clearly calls
>atts.getQName(i) on line 607 of SAXBuilder.java.  I'm confused.

This looks like a classpath trouble: the getQName method is only in 
the SAX2 package, if I remember well. If your program has loaded the 
org.xml.sax.Attributes interface from SAX1 distribution then the 
method will not be in it and you'll have that exception.

Affirmations not verified but this looks like it is possible you have 
put a SAX1 package containing jar earlier in your classpath than the 
xerces one.
The latter is often useful to be at very first place.


More information about the jdom-interest mailing list