Maven和JAXB出错

时间:2014-12-16 13:58:12

标签: java maven jaxb

我已经编写了一个使用JAXB的小型Java程序。在Eclipse中它运行正常!外翻工作......

然后我参与了Maven,当我执行Jar(从Maven生成)时,我收到以下错误:

Dez 16, 2014 2:51:15 PM com.sun.xml.internal.bind.v2.util.XmlFactory createParserFactory
SCHWERWIEGEND: null
org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing
        at org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.setFeatures(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParserImpl(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.setFeature(Unknown Source)
        at com.sun.xml.internal.bind.v2.util.XmlFactory.createParserFactory(Unknown Source)
        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(Unknown Source)
        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
        at javax.xml.bind.JAXB.unmarshal(Unknown Source)
        at de.lsd.jimp.controller.JImpController.doJAXB(JImpController.java:70)
        at de.lsd.jimp.controller.JImpController.<init>(JImpController.java:46)
        at de.lsd.jimp.init.JImp.initController(JImp.java:195)
        at de.lsd.jimp.init.JImp.main(JImp.java:219)

ERROR [2014-12-16 14:51:15,626] - Fehler bei JAXB.unmarshal aufgetreten! Thread:main Class:de.lsd.jimp.controller.JImpController Method:doJAXB
java.lang.IllegalStateException: org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing
        at com.sun.xml.internal.bind.v2.util.XmlFactory.createParserFactory(Unknown Source)
        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(Unknown Source)
        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
        at javax.xml.bind.JAXB.unmarshal(Unknown Source)
        at de.lsd.jimp.controller.JImpController.doJAXB(JImpController.java:70)
        at de.lsd.jimp.controller.JImpController.<init>(JImpController.java:46)
        at de.lsd.jimp.init.JImp.initController(JImp.java:195)
        at de.lsd.jimp.init.JImp.main(JImp.java:219)
Caused by: org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing
        at org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.setFeatures(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParserImpl(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.setFeature(Unknown Source)

我的POM文件看起来像这样:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>JImp</groupId>
    <artifactId>JImp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>de.own.jimp.init.JImp</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.5</version>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2</version>
        </dependency>
        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.9</version>
        </dependency>
        <dependency>
            <groupId>ownSWT64</groupId>
            <artifactId>ownSWT64</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>ownJFace</groupId>
            <artifactId>ownJFace</artifactId>
            <version>3.8.102</version>
        </dependency>
        <dependency>
            <groupId>ownOjdbc</groupId>
            <artifactId>ownOjdbc</artifactId>
            <version>14</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.core</groupId>
            <artifactId>runtime</artifactId>
            <version>3.10.0-v20140318-2214</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.core</groupId>
            <artifactId>commands</artifactId>
            <version>3.3.0-I20070605-0010</version>
        </dependency>
        <dependency>
            <groupId>revofubi</groupId>
            <artifactId>revofubi</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
</project>

我发现这是由Maven引起的问题(在Eclipse中它起作用..)。我还读到这个问题是由集成的依赖引起的?!

我无法解决它..

也许你有这个问题的经验..!

感谢您的帮助!!

0 个答案:

没有答案