尽管设置了依赖项,Wildfly 10 中仍出现 ClassNotFoundException

stm*_*ius 5 java jboss wildfly wildfly-10

我正在 WildFly 10 上运行一个应用程序。它在 EAR 中包含许多 EJB。我有一个通过 JMS 触发的 EJB“gt”。该 EJB 调用另一个 EJB“ps”,最终导致错误

Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.filefilter.IOFileFilter from [Module "deployment.MyApplication.ear:main" from Service Module Loader]

我的 jboss-deployment-struct.xml 包含这个

<sub-deployment name="ps.jar">
  <dependencies>
    <module name="org.apache.commons.io"/>
  </dependencies>
</sub-deployment>
Run Code Online (Sandbox Code Playgroud)

并且下面有一个名为“org.apache.commons.io”的模块jboss\modules\system\layers\base\org\apache\commons\io\main

我究竟做错了什么?jboss\modules\system\layers东西在下面而不是仅仅在下面有什么意义jboss\modules

有没有办法在运行时查看子部署的配置依赖项,例如通过 jboss-cli?

更新:
根据https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly,我本以为错误消息会说,但事实并非如此。但为什么上下文是全局部署,而不是特定的子部署呢?[Module "deplyoment.MyApplication.ear.ps.jar:main" ...]

逻辑调用堆栈如下所示:

general.GeneralSomeClass.getIOFileFilter()
    <-- static method. return type is IOFileFilter from Commons IO. 
        general is just a POJO lib (MyApplication.ear/lib/general.jar)
        the exception occurs on loading the GeneralSomeClass, before calling the method
ps.PsSomeClass.run()
ps.PsEJB.run()
gt.GtEJB.run()
Run Code Online (Sandbox Code Playgroud)

stm*_*ius 0

我们最终使用了 MANIFEST.MF 中的 Dependency: 选项,完全摆脱了 jboss-deployment-struct.xml。