- Red Hat JBoss Enterprise Application Platform (EAP)
- I have an application that has the following dependency in our pom.xml, but when I deploy our application, it comes up with a java.lang.ClassNotFoundException because there is no dependency on this module in my jboss-deployment-structure.xml file. How do we get this to be generated correctly?
<dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> <version>2.3.10.Final-redhat-1</version> <scope>provided</scope> </dependency>
Although they are both called "dependencies", there is no relationship between a Maven dependency in
pom.xml and a JBoss EAP module dependency in
jboss-deployment-structure.xml. The pom file is correct, JBoss EAP modules should be defined using
<scope>provided</scope> which is used to compile time to tell Maven that the jar should not be packaged in the application as it will be provided at runtime by the application server.
It's also necessary to add the module dependency in
jboss-deployment-structure.xml as this is what causes the module to be made visible at runtime by the application.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.