Netbeans不承认xercesimpl

时间:2013-08-31 17:41:27

标签: netbeans xerces batik

我正在尝试使用maven为netbeans构建一个插件,但由于某些原因,Netbeans无法识别插件随附的xercesimpl.jar。这是我看到的堆栈跟踪。

java.io.IOException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
    at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:353)
    at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:276)
    at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:207)
    at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocument(SAXSVGDocumentFactory.java:105)
[catch] at org.netbeans.modules.plantumlnb.SVGImagePreviewPanel.createSVGDocument(SVGImagePreviewPanel.java:59)
    at org.netbeans.modules.plantumlnb.SVGImagePreviewPanel.renderSVGFile(SVGImagePreviewPanel.java:48)
    at org.netbeans.modules.plantumlnb.RenderImageThread$1.run(RenderImageThread.java:56)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:694)
    at java.awt.EventQueue$3.run(EventQueue.java:692)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

这是显示xercesimpl.jar确实与nbm文件一起打包的图像。

enter image description here

以下是构建过程中下载的所有jar的列表。

NBM Plugin generates manifest
Adding on module's Class-Path:
    net.sourceforge.plantuml:plantuml:jar:7959
    batik:batik-swing:jar:1.6-1
    batik:batik-bridge:jar:1.6-1
    batik:batik-gvt:jar:1.6-1
    batik:batik-awt-util:jar:1.6-1
    batik:batik-script:jar:1.6-1
    rhino:js:jar:1.5R4.1
    batik:batik-svg-dom:jar:1.6-1
    batik:batik-dom:jar:1.6-1
    batik:batik-xml:jar:1.6-1
    xerces:xercesImpl:jar:2.5.0
    batik:batik-parser:jar:1.6-1
    batik:batik-css:jar:1.6-1
    batik:batik-rasterizer:jar:1.6-1
    batik:batik-transcoder:jar:1.6-1
    fop:fop:jar:0.20.5
    batik:batik-1.5-fop:jar:0.20-5
    xml-apis:xml-apis:jar:1.0.b2
    xalan:xalan:jar:2.4.1
    avalon-framework:avalon-framework:jar:4.0
    batik:batik-util:jar:1.6-1
    batik:batik-gui-util:jar:1.6-1
    batik:batik-ext:jar:1.6-1
    xml-apis:xmlParserAPIs:jar:2.0.2
    org.axsl.org.w3c.dom.svg:svg-dom-java:jar:1.1
    org.axsl.org.w3c.dom.smil:smil-boston-dom-java:jar:2000-02-25
    org.w3c.css:sac:jar:1.3
    crimson:crimson:jar:1.1.3

我不确定我缺少什么,感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

我的依赖关系不对,所以一旦我修复它们,它就开始识别了。对于任何希望在基于maven的netbeans模块中包含Batik的人,我将包括下面的依赖项。

    <dependency>
        <groupId>batik</groupId>
        <artifactId>batik-swing</artifactId>
        <version>1.6-1</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>batik</groupId>
        <artifactId>batik-script</artifactId>
        <version>1.6-1</version>
        <!-- exclude xerces as Netbeans includes it -->
        <exclusions>
            <exclusion>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- include xerces in test scope as unittests need it -->
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.5.0</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>