How to specify a dependency on a JBoss Module in JBoss EAP 6 / 7

Solution Verified - Updated -

Issue

  • How to specify a dependency on a JBoss Module in JBoss EAP 6
  • Dependencies in MANIFEST.MF in JBoss EAP 6
  • Referring to jar file from modules. We have a jar file which has to be referenced from modules ($JBOSS_HOME/modules/test/api/main/xx.jar) and not from WEB-INF/lib of EAR application. Therefore added Dependencies: test.api in MANIFEST.MF and below code in jboss-deployment-structure.xml. However ClassNotFoundException is thrown at runtime. How this can be achieved. Jar file has to be in modules as this is required for other dependencies.
<?xml version="1.0"?>
<deployment>
  <dependencies>
    <module name="test.api"/>
  </dependencies>
</deployment>
  • How to declare a dependency on a JBoss module in JBoss EAP 6?
  • I created com/mysql/main under modules and placed the mysql-connector-java-5.1.35-bin.jar in there. I created a module.xml file with these contents and put that in the same directory, still When I run my application on the server it says that it can not find the driver.:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql"> 
    <resources>  
        <resource-root path="mysql-connector-java-5.1.35-bin.jar" />  
    </resources>
    <dependencies>  
        <module name="javax.api"/>  
        <module name="javax.transaction.api"/>  
    </dependencies>  
</module>

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content