EAR deployment fails when EJB jar is located under library-directory in EAP 6.x/7.x

Solution Verified - Updated -

Issue

I migrated an EAR application running on EAP 5.x to EAP 7.x. Then, the following ERROR happened and the EAR deployment failed:

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."example.ear".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."example.ear".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "example.ear"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:151)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1738)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1700)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1558)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0097: Module may not be a child of the EAR's library directory. Library directory: lib, module file name: lib/ejb.jar
    at org.jboss.as.ee.structure.EarStructureProcessor.deploy(EarStructureProcessor.java:194)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:144)
    ... 8 more 

The application structure is like the following:

example.ear
 ├── lib
 │   ├── test.jar
 │   ├── ejb.jar
 │   └── appclient.jar
 └── META-INF
     └── application.xml

And application.xml has the following content:

<application>
    <application-name>example-ear</application-name>
    <display-name>example-ear</display-name>
    <module>
        <ejb>lib/ejb.jar</ejb>
    </module>
    <module>
        <java>lib/appclient.jar</java>
    </module>
</application>

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.0.1 or later
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In