[jdom-interest] NoSuchMethodError: org.w3c.dom.DocumentType

Jason Hunter jhunter at collab.net
Tue Jan 30 16:24:51 PST 2001


Look in your standard extensions directory and I'll bet you find a DOM1
implementation.  (See the FAQ for details on why such a thing would
cause this error.)

-jh-

Tad Shimada wrote:
> 
> Hello,
> 
> I have a very innocent looking code like this one. All I want to do is
> to print out the contents of my xml file.
> 
> import java.io.* ;
> import org.jdom.* ;
> import org.jdom.input.DOMBuilder ;
> import org.jdom.output.XMLOutputter ;
> 
> public class DOMBuilderTest
> {
>   public static void main( String[] args ) {
>     try {
>       DOMBuilder builder = new DOMBuilder() ;
>       Document doc = builder.build( new File( "../linux.xml") ) ;
>       XMLOutputter o = new XMLOutputter() ;
>       o.output( doc, System.out ) ;
>     }
>     catch( IOException e ) {
>       e.printStackTrace() ;
>     }
>     catch( JDOMException e ) {
>       e.printStackTrace() ;
>     }
>   }
> }
> 
> After compiling this code, when I tried to run it, it gave me a
> run-time exception that reads as follows.
> 
> Exception in thread "main" java.lang.NoSuchMethodError:
> org.w3c.dom.DocumentType: method
> getPublicId()Ljava/lang/String; not found
>         at org.jdom.input.DOMBuilder.buildTree(DOMBuilder.java,
> Compiled Code)
>         at org.jdom.input.DOMBuilder.buildTree(DOMBuilder.java,
> Compiled Code)
>         at org.jdom.input.DOMBuilder.build(DOMBuilder.java, Compiled
> Code)
>         at org.jdom.input.DOMBuilder.build(DOMBuilder.java, Compiled
> Code)
>         at JDOMTest.domDocument(JDOMTest.java, Compiled Code)
>         at JDOMTest.main(JDOMTest.java, Compiled Code)
> 
> I have set my CLASSPATH like this.
> 
> /my_home/jdom/build/jdom.jar:/my_home/xerces/xerces.jar:\
> /opt2/oraclient/sqlj/lib/translator.zip:/opt2/oraclient/jdbc/lib/classes12.zip:\
> 
> /opt2/oraclient/jdbc/charset12.zip:/opt2/j2sdkee1.2.1/lib/j2ee.jar:\
> /opt2/jdk1.2.2/lib/tools.jar:/opt2/jdk1.2.2/lib/dt.jar:/home/tad:/opt2/tomcat/classes:.
> 
> 
> 
> As for jdom.jar, I am using beta5. Also tried beta4. As for
> xerces.jar, I tried with 1.2.3, 1.2.1 and the version that came with
> jdom download. They all resulted
> in the same result.
> 
> Any help will be very much appreciated.
> 
> Thanks,
> Tad
> 
>



More information about the jdom-interest mailing list