1

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?

Jonathan
  • 2,698
  • 24
  • 37

1 Answers1

2

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.

James R. Perkins
  • 16,800
  • 44
  • 60
  • To clarify: If i put a lib in /lib it is available to all modules. If I put it into the `` section (insteadof the `` section), where is it visible? – Jonathan Aug 18 '20 at 09:13
  • 1
    If you add it as a module and use the `jboss-deployment-structure.xml` you need to add the dependencies to each deployment and sub-deployment that needs a dependency on the module. – James R. Perkins Aug 18 '20 at 14:30