简体   繁体   English

Wildfly 模块类加载

[英]Wildfly module classloading

I have come across a rather curious issue with wildfly classloading.我遇到了一个关于 Wildfly 类加载的相当奇怪的问题。 I have a java-ee webapp, structured as follows:我有一个 java-ee webapp,结构如下:

some.ear
+- some.war
+- EJBs.jar

both the war and the jar require some spring classes to function properly.战争和 jar 都需要一些 spring 类到 function 正确。 I defined a spring module containing the relevant classes.我定义了一个包含相关类的 spring 模块。 Within jboss-deployment-structure I have a section as follows:jboss-deployment-structure我有一个部分如下:

<jboss-deployment-structure>
<deployment>
    <dependencies>
        ...
        <module name="org.springframework.spring-web"/>
        ...
    </dependencies>
</deployment>

After launching my webapp, I get a ClassNotFoundException when deploying the war-archive.启动我的 web 应用程序后,我在部署战争档案时收到ClassNotFoundException If I add an additional section如果我添加一个额外的部分

<sub-deployment name="some.war">
    <dependencies>
        ...
        <module name="org.springframework.spring-web"/>
        ...
    </dependencies>
</sub-deployment>

it works.有用。

My understanding is, that every module from the main-deployment section should also be visible in all sub-deployments.我的理解是,主部署部分的每个模块也应该在所有子部署中可见。

Can anyone shed some light on this issue?任何人都可以对这个问题有所了解吗?

Each sub-deployment would need it's own set of module dependencies.每个子部署都需要它自己的一组模块依赖项。 If you were to include the module libraries in the EAR/lib directory instead of creating a module then you'd not need to add the module dependency for each sub-deployment.如果您要在EAR/lib目录中包含模块库而不是创建模块,那么您不需要为每个子部署添加模块依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM