建议你检查一下你的classpath,一般这样的问题就是因为classpath设置。

解决方案 »

  1.   

    but j2sdk1.4是包含了jaxp.jar的了,也就是说,只要设置好jdk路径就可以的了,而我的jdk路径是设好的了,没有问题另外,为了检查是否这个问题,我也特意下载了一个jaxp.jar,把它也包含到了classpath中,但这样也不行,所以我好痛苦啊,why~~~~
      

  2.   

    你在程序中将DocumentBuilder写成:
    javax.xml.parsers.DocumentBuilderDocumentBuilderFactory写成:
    javax.xml.parsers.DocumentBuilderFactory因为JDK自己带的和你下的JAXP版本不同!同时也可能是你的classpath的问题!所以,最终我建议你:将:jaxp.jar拷贝到jdk\jre\lib\下classpath=.;
    就可以了!不要给classpath附加任何东西!
      

  3.   

    还是不行,已经按建议把DocumentBuilderFactory写成:
    javax.xml.parsers.DocumentBuilderFactory
    将DocumentBuilder写成:
    javax.xml.parsers.DocumentBuilder
    了,
    又把classpath改过了,但最后还是出现同样的错误,不知为何,
    非常郁闷~
      

  4.   

    Check whether you have included any other xml parsers in the classpath? if that is the case, it may cause problem.
       All the XML parsers (from Sun, Apache, IBM) implement the SAM and DOM interface, but the detailed implementation can be different
      

  5.   

    还是不行,因为我不知道该如何注意版本和顺序的问题,也就是说我不知道javax.xml.parsers这个包是放在哪里的,所以不知该如何设置具体避免冲突的问题,或是根本不用设置,请你一个具体的配置路径,而且可以运行得了的jaxp调用例子配置classpath方案,好吗?
      

  6.   

    一般你得注意Jaxp、Xerces、Parser、Xml几个Jar文件,最好打开看看,把新的放在最前面