wildfly中的xml-api jar问题 - 模块加载优先级

时间:2017-05-30 07:53:56

标签: wildfly

我正在wildfly中创建全局模块,其中包括xml-api jar。 但是当对xml文件进行解析时,它会抛出以下异常。

我在论坛中搜索了很多帖子说要从类路径中删除xml-api和xml-beans jar。因为JBoss / JDK xml jar和我们的xml-api jar都存在冲突。但我需要让我的罐装上优先权。我怎样才能做到这一点。请提供建议。

13:11:51,686 ERROR [stderr] (default task-1) Caused by: java.lang.ClassCastExcep
tion: __redirected.__DatatypeFactory cannot be cast to javax.xml.datatype.Dataty
peFactory
13:11:51,688 ERROR [stderr] (default task-1)    at javax.xml.datatype.DatatypeFa
ctory.newInstance(Unknown Source)
13:11:51,690 ERROR [stderr] (default task-1)    at com.thoughtworks.xstream.conv
erters.extended.DurationConverter$1.getFactory(DurationConverter.java:39)
13:11:51,691 ERROR [stderr] (default task-1)    at com.thoughtworks.xstream.conv
erters.extended.DurationConverter.<init>(DurationConverter.java:44)
13:11:51,691 ERROR [stderr] (default task-1)    ... 74 more 

由于 塞特希

1 个答案:

答案 0 :(得分:1)

我解决了这个问题。 我删除了以下模块,并在我的module.xml中添加了javax.api和org.slf4j作为依赖项。这是因为wildfly已经拥有这些模块并作为核心类加载的一部分加载。这就是重新加载时发生冲突的原因。

Module.xml

删除内容:

<resource-root path="xml-apis-<version>.jar">
<resource-root path="slf4j-api-<version>.jar"/>

已添加内容:

<dependencies>
         <module name="javax.api"/>
        <module name="org.slf4j"/>
  </dependencies>

更正了Module.xml

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="drools">
    <resources>

        <resource-root path="aether-api-1.0.0.v20140518.jar"/>
        <resource-root path="aether-connector-basic-1.0.0.v20140518.jar"/>
        <resource-root path="aether-impl-1.0.0.v20140518.jar"/>
        <resource-root path="aether-spi-1.0.0.v20140518.jar"/>
        <resource-root path="aether-transport-file-1.0.0.v20140518.jar"/>
        <resource-root path="aether-transport-http-1.0.0.v20140518.jar"/>
        <resource-root path="aether-transport-wagon-1.0.0.v20140518.jar"/>
        <resource-root path="aether-util-1.0.0.v20140518.jar"/>
        <resource-root path="ant-1.8.3.jar"/>
         <resource-root path="ant-launcher-1.8.3.jar" />   
         <resource-root path="antlr-runtime-3.5.jar"/>
        <resource-root path="aopalliance-1.0.jar"/>
        <resource-root path="cdi-api-1.0-SP4.jar"/>
        <resource-root path="commons-codec-1.4.jar"/>
        <resource-root path="commons-lang-2.6.jar"/>
        <resource-root path="commons-logging-1.1.1.jar"/>
        <resource-root path="dom4j-1.6.1.jar"/>
        <resource-root path="drools-beliefs-6.5.0.Final.jar"/>

        <resource-root path="drools-compiler-6.5.0.Final.jar"/>
        <resource-root path="drools-core-6.5.0.Final.jar"/>
        <resource-root path="drools-decisiontables-6.5.0.Final.jar"/>
        <resource-root path="drools-jsr94-6.5.0.Final.jar"/>
        <resource-root path="drools-persistence-jpa-6.5.0.Final.jar"/>
        <resource-root path="drools-pmml-6.5.0.Final.jar"/>
        <resource-root path="drools-reteoo-6.5.0.Final.jar"/>
        <resource-root path="drools-scorecards-6.5.0.Final.jar"/>
        <resource-root path="drools-verifier-6.5.0.Final.jar"/>
        <resource-root path="drools-templates-6.5.0.Final.jar"/>

        <resource-root path="ecj-4.4.2.jar"/>
        <resource-root path="guava-13.0.1.jar"/>
        <resource-root path="hibernate-jpa-2.0-api-1.0.1.Final.jar"/>
        <resource-root path="httpclient-4.3.6.jar"/>
        <resource-root path="httpcore-4.3.3.jar"/>
        <resource-root path="itext-2.1.2.jar"/>
        <resource-root path="javassist-3.18.1-GA.jar"/>
        <resource-root path="javax.inject-1.jar"/>
        <resource-root path="jaxb-core-2.2.11.jar"/>
        <resource-root path="jaxb-impl-2.2.11.jar"/>
                <resource-root path="jboss-interceptors-api_1.1_spec-1.0.1.Final.jar"/>
        <resource-root path="jboss-transaction-api_1.1_spec-1.0.1.Final.jar"/>
        <resource-root path="jcl-over-slf4j-1.7.2.jar"/>
        <resource-root path="jsoup-1.8.3.jar"/>
        <resource-root path="jsr94-1.1.jar"/>
        <resource-root path="jsr250-api-1.0.jar"/>
        <resource-root path="kie-api-6.5.0.Final.jar"/>
                <resource-root path="kie-ci-6.5.0.Final.jar"/>
        <resource-root path="kie-internal-6.5.0.Final.jar"/>
                                <resource-root path="knowledge-api-6.5.0.Final.jar"/>

        <resource-root path="maven-aether-provider-3.2.5.jar"/>
         <resource-root path="maven-artifact-3.2.5.jar" />   
    <resource-root path="maven-compat-3.2.5.jar"/> 
        <resource-root path="maven-core-3.2.5.jar"/>
        <resource-root path="maven-model-3.2.5.jar"/>
        <resource-root path="maven-model-builder-3.2.5.jar"/>
        <resource-root path="maven-plugin-api-3.2.5.jar"/>
        <resource-root path="maven-repository-metadata-3.2.5.jar"/>

        <resource-root path="maven-settings-3.2.5.jar"/>
        <resource-root path="maven-settings-builder-3.2.5.jar"/>
        <resource-root path="mvel2-2.2.8.Final.jar"/>
        <resource-root path="org.eclipse.sisu.inject-0.3.0.M1.jar"/>
        <resource-root path="org.eclipse.sisu.plexus-0.3.0.M1.jar"/>
        <resource-root path="plexus-cipher-1.7.jar"/>
        <resource-root path="plexus-classworlds-2.5.2.jar"/>
            <resource-root path="plexus-component-annotations-1.5.5.jar"/> 
         <resource-root path="plexus-interpolation-1.21.jar"/>
        <resource-root path="plexus-sec-dispatcher-1.3.jar"/>
        <resource-root path="plexus-utils-3.0.20.jar"/>
        <resource-root path="poi-3.13.jar"/>
        <resource-root path="poi-ooxml-3.13.jar"/>  
        <resource-root path="poi-ooxml-schemas-3.13.jar"/>
        <resource-root path="protobuf-java-2.6.0.jar"/>

        <resource-root path="sisu-guice-3.2.3-no_aop.jar"/>
    <!--    <resource-root path="slf4j-api-1.7.2.jar"/>  -->
        <resource-root path="stax-api-1.0.1.jar"/>
        <resource-root path="wagon-http-2.6.jar"/>
         <resource-root path="wagon-http-shared-2.6.jar"/> 
        <resource-root path="wagon-provider-api-2.6.jar"/>
        <resource-root path="xmlbeans-2.3.0.jar"/>
         <resource-root path="xmlpull-1.1.3.1.jar"/> 
        <resource-root path="xpp3_min-1.1.4c.jar"/>
        <resource-root path="xstream-1.4.9.jar"/>
    </resources>
 <dependencies>

        <module name="javax.api"/>
        <module name="org.slf4j"/>

  </dependencies>
</module>

由于

塞特希