My Project structure is
parent
|---ejb-app.jar
|---restapi-app.war
|---ear-app.ear
I am using commons-beanutils to map the JavaEntity Bean to normal POJO class(DTO). The implementation of commons-beanutils is available inside ejb-app.jar.
Example: BeanUtils.copyProperties(destination, source);
My ear-app.ear aaplication packages the two modules such as ejb-app.jar & restapi-app.war. Below I have added pom.xml of ear-app.ear
<?xml version="1.0" encoding="UTF-8"?>
<parent>
<groupId>migration</groupId>
<artifactId>migration-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../migration-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.ear.app</groupId>
<artifactId>ear-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>
<name>ear-app</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.ejb.app</groupId>
<artifactId>ejb-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>org.restapi.app</groupId>
<artifactId>restapi-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2.redhat-1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<modules>
<ejbModule>
<groupId>org.ear.app</groupId>
<artifactId>ear-app</artifactId>
<bundleFileName>ejb-app-0.0.1-SNAPSHOT.jar</bundleFileName>
</ejbModule>
<webModule>
<groupId>org.restapi.app</groupId>
<artifactId>restapi-app</artifactId>
<contextRoot>/</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- WildFly plug-in to deploy EAR -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
Problem: When I deploy my aaplication in RedHat JBoss EAP7 server, I am getting the following error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.beanutils.BeanUtils from [Module "deployment.ear-app-0.0.1-SNAPSHOT.ear.ejb-app-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]