5

I'm running an application on WildFly 10. It contains a number of EJBs in an EAR. I have one EJB "gt" being triggered via JMS. That EJB calls another EJB "ps", resulting in an error, ultimately

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

My jboss-deployment-structure.xml contains this

<sub-deployment name="ps.jar">
  <dependencies>
    <module name="org.apache.commons.io"/>
  </dependencies>
</sub-deployment>

And there is a module of name "org.apache.commons.io" under jboss\modules\system\layers\base\org\apache\commons\io\main

What am I doing wrong? What is the significance of stuff being under jboss\modules\system\layers rather than just under jboss\modules?

Is there a way to look into the configured dependencies of a sub-deployment at runtime, e.g, via the jboss-cli?

Update:
According to https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly, I would have expected the error message to say [Module "deplyoment.MyApplication.ear.ps.jar:main" ...], but it doesn't. But why would the context be the global deployment, rather than the specific sub-deployment?

The logical call stack looks like this:

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()
stmoebius
  • 662
  • 11
  • 30
  • Have you tried add the dependency to the EAR instead of just the sub-deployment? Just to answer the modules directory question. `modules\system\layers` is meant for server provided modules. User modules should just go in the `modules` directory e.g. `modules/org/postgresql/main`. – James R. Perkins Sep 06 '16 at 16:13

2 Answers2

1

You need to load the classes manually in that case, I have done this in the standalone.xml for our application.

<subsystem xmlns="urn:jboss:domain:ee:4.0">
            <global-modules>
                <module name="com.tibco.tibjms"/>
                <module name="org.apache.logging.log4j.api"/>
                <module name="org.apache.logging.log4j.core"/>
                <module name="org.apache.logging.log4j.web"/>
            </global-modules>
Zeus
  • 6,386
  • 6
  • 54
  • 89
0

We ended up using the Dependencies: option in MANIFEST.MF, getting rid of the jboss-deployment-structure.xml altogether.

stmoebius
  • 662
  • 11
  • 30