在WildFly中加载类

时间:2017-03-30 08:17:02

标签: deployment jboss wildfly xerces

请考虑以下jboss-deployment-structure.xml耳内META-INF的结构

<!-- Make sub deployments not isolated so they can see each others classes without a Class-Path entry (default is true) -->  
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>  

<deployment>  
    <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->  
    <exclusions>  
        <module name="org.apache.xerces" />  
    </exclusions>  
</deployment>  

<sub-deployment name="mySubDeployment.war">  
    <exclusions>  
        <module name="org.apache.log4j" />  
    </exclusions>  
    <dependencies>  
        <system>  
            <paths>  
                <path name="com/sun/org/apache/xerces/internal/dom"/>  
                <path name="com/sun/org/apache/xerces/internal/xni"/>  
                <path name="com/sun/org/apache/xerces/internal/jaxp"/>  
            </paths>  
        </system>  
    </dependencies>  
</sub-deployment>  

鉴于此,我已从部署(第11行)中排除了默认org.apache.xerces模块,并在xercesImpl.jar文件夹或耳中部署了自定义APP-INF/lib。此外,我还为mySubDeployment.war子部署添加了路径依赖关系。

将为mySubDeployment.war加载xerces的类别?来自WildFly的默认com.apache.xerces模块或APP-INF/lib中部署的自定义jar?

在子部署中添加路径依赖项的确切含义是什么?是否会忽略主要部署下的排除(即org.apache.xerces)?

1 个答案:

答案 0 :(得分:1)

你不应该真的需要这些路径。您还必须为每个sub-deployment排除xerces。

APP-INF目录也不是标准的Java EE目录。您需要将库放在EAR的/lib目录中。