JAXB实现的Jar问题

时间:2015-08-30 08:15:24

标签: java jboss jaxb docx4j

我试图使用docx4j库来操作文档,并且作为一个独立的程序,该程序工作正常但是当我在jBoss中部署它时,它给出了以下错误

我已经检查过并发现jboss -path中存在jaxb-impl.jar

10:44:28,118 INFO  [stdout] (http-0.0.0.0-0.0.0.0-9080-5) 2015-08-30 10:44:28,118 ERROR [http-0.0.0.0-0.0.0.0-9080-5] [org.docx4j.jaxb.Context] - PANIC! No suitable JAXB implementation available

10:44:28,118 ERROR [stderr] (http-0.0.0.0-0.0.0.0-9080-5) javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: Provider class com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/Documentum/jboss7.1.1/modules/javax/xml/bind/api/main/jboss-jaxb-api_2.2_spec-1.0.3.Final.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/Documentum/java64/1.7.0_17/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.
10:44:28,133 ERROR [stderr] (http-0.0.0.0-0.0.0.0-9080-5)  - with linked exception:
10:44:28,133 ERROR [stderr] (http-0.0.0.0-0.0.0.0-9080-5) [javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/Documentum/jboss7.1.1/modules/javax/xml/bind/api/main/jboss-jaxb-api_2.2_spec-1.0.3.Final.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/Documentum/java64/1.7.0_17/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.]
10:44:28,133 ERROR [stderr] (http-0.0.0.0-0.0.0.0-9080-5)  - with linked exception:
10:44:28,133 ERROR [stderr] (http-0.0.0.0-0.0.0.0-9080-5) [javax.xml.bind.JAXBException: Provider class com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/Documentum/jboss7.1.1/modules/javax/xml/bind/api/main/jboss-jaxb-api_2.2_spec-1.0.3.Final.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/Documentum/java64/1.7.0_17/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.
10:44:28,133 ERROR [stderr] (http-0.0.0.0-0.0.0.0-9080-5)  - with linked exception:
10:44:28,133 ERROR [stderr] (http-0.0.0.0-0.0.0.0-9080-5) [javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/Documentum/jboss7.1.1/modules/javax/xml/bind/api/main/jboss-jaxb-api_2.2_spec-1.0.3.Final.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/Documentum/java64/1.7.0_17/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.]]

下面是jBoss-deployment-structure.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
    <ear-subdeployments-isolated>true</ear-subdeployments-isolated>

    <!-- This corresponds to the top level deployment, for bpm.ear -->
    <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->
    <deployment>
        <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
        <exclusions>
            <module name="org.apache.log4j"/>
            <module name="org.apache.commons.logging"/>
            <module name="javax.jms.api"/>
            <module name="javax.xml.bind.api"/>
        </exclusions>
        <!-- Castor API we use in parsing XML schemas depends on xerces parser -->
        <dependencies>
            <module name="org.apache.xerces" />
        </dependencies>
    </deployment>
    <!-- This corresponds to the bpm.war's module -->
    <sub-deployment name="bpm.war">
        <exclusions>
            <module name="org.apache.log4j"/>
            <module name="org.apache.commons.logging"/>
            <module name="javax.jms.api"/>
            <module name="javax.xml.bind.api"/>
        </exclusions>
    </sub-deployment>


</jboss-deployment-structure>

0 个答案:

没有答案