野飞模块类加载

huangapple go评论67阅读模式
英文:

Wildfly module classloading

问题

我在使用Wildfly的类加载过程中遇到了一个相当奇怪的问题。我有一个Java EE Web应用程序,结构如下:

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

无论是war文件还是jar文件都需要一些Spring类来正常运行。我定义了一个包含相关类的Spring模块。在jboss-deployment-structure中,我有一个如下所示的部分:

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

启动我的Web应用程序后,部署war存档时出现ClassNotFoundException错误。
如果我添加一个额外的部分

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

它就能正常工作。

我理解的是,主部署部分中的每个模块在所有子部署中也应该可见。

是否有人能够解决这个问题?

英文:

I have come across a rather curious issue with wildfly classloading. I have a java-ee webapp, structured as follows:

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

both the war and the jar require some spring classes to function properly. I defined a spring module containing the relevant classes. Within jboss-deployment-structure I have a section as follows:

<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.
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?

答案1

得分: 2

每个子部署都需要它自己的模块依赖。如果您将模块库包含在EAR/lib目录中,而不是创建一个模块,那么您就不需要为每个子部署添加模块依赖。

英文:

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.

huangapple
  • 本文由 发表于 2020年8月16日 23:46:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/63438866.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定