`
夏莹_合肥
  • 浏览: 180341 次
  • 性别: Icon_minigender_1
  • 来自: 合肥
社区版块
存档分类
最新评论

org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found

    博客分类:
  • Ant
阅读更多

在eclipse中执行main方法的时候,默认的XML解析类是com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl,这个是没问题的。
但是当用ant的java标签执行该main方法的时候却出了问题,例如

 

<target name="com.yingxia.trms.clean">
        <java classname="com.yingxia.trms.clean.CleanImageFile">
            <classpath refid="classpath" />
        </java>
    </target>

 

原来ant执行的时候,默认的XML解析类是org.apache.xerces.jaxp.DocumentBuilderFactoryImpl,所以报了如上的错误。
解决方法,在XML解析之前,强制性的指定:

 

System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics