My Project structure is
parent
|---ejb-app.jar
|---restapi-app.war
|---ear-app.ear
我使用commons-beanutils将JavaEntity Bean映射到普通的POJO类(DTO)。 commons-beanutils的实现可以在ejb-app.jar中找到。
Example: BeanUtils.copyProperties(destination, source);
我的耳朵应用程序将ejb-app.jar和RESTAPI-app.war。下面我添加了ear-app.ear的pom.xml
<?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>
问题: 当我在RedHat JBoss EAP7服务器中部署我的应用程序时,我收到以下错误: 引起:java.lang.ClassNotFoundException:org.apache.commons.beanutils.BeanUtils来自[Module&#34; deployment.ear-app-0.0.1-SNAPSHOT.ear.ejb-app-0.0.1-SNAPSHOT.jar :主&#34;来自服务模块加载器]