0
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);

我的ear-app.ear aaplication 打包了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 from [Module "deployment.ear-app-0.0. 1-SNAPSHOT.ear.ejb-app-0.0.1-SNAPSHOT.jar:main" 来自服务模块加载器]

4

0 回答 0