带有共享库的EAR中具有WAR的Classpath的ClassNotFoundException?

时间:2015-02-09 21:20:42

标签: java maven java-ee ibm-was

我有一个包含WAR和EJB(jar)的EAR。 EJB和WAR共享一些库,因此我想使用maven-ear-plugin生成一个skinnyWar。

我将我的耳塞配置为共享库作为依赖项,并将<skinnyWars>选项设置为true。

我看到我的EAR正确建造;公共库是从我的WAR中提取出来并放在EAR中的。

当我在Websphere 8.5上启动EAR时,我的问题是WAR无法找到保留在WAR / WEB-INF / lib文件夹中的类。

我在war / META-INF /中检查了MANIFEST.MF并查看列出的所有库(war / web-inf / lib文件夹中的文件以及常用库),但是我保留了这些库每当我尝试从WEB-INF / lib / xxx.jar中访问类时,都会获得ClassNotFoundException

(来自pom.xml的片段)

<dependencies>
    <dependency>
        <groupId>com.webinfo</groupId>
        <artifactId>WebInfoWebApp</artifactId>
        <version>${project.version}</version>
        <type>war</type>
    </dependency>

    <dependency>
        <groupId>com.webinfo</groupId>
        <artifactId>WebInfoEJB</artifactId>
        <version>${project.version}</version>
        <type>ejb</type>
    </dependency>


    <!-- In order to make skinnyWars, need to list all the common dependencies of the EAR here -->
    <!-- Use the ejb pom to list all the ejb dependencies here automatically -->
    <dependency>
        <groupId>com.webinfo</groupId>
        <artifactId>WebInfoEJB</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
    </dependency>
</dependencies>

<build>
    <plugins>
        <!-- EAR plugin -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.10</version>
            <configuration>
                <defaultLibBundleDir>/</defaultLibBundleDir>
                <skinnyWars>true</skinnyWars>
                <archive>
                    <manifestFile>META-INF/MANIFEST.MF</manifestFile>
                    <manifest>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>

                <modules>

                    <webModule>
                        <groupId>com.webinfo</groupId>
                        <artifactId>WebInfoWebApp</artifactId>
                        <bundleFileName>WebInfoWeb.war</bundleFileName>
                    </webModule>

                    <ejbModule>
                        <groupId>com.webinfo</groupId>
                        <artifactId>WebInfoEJB</artifactId>
                        <bundleFileName>WebInfoEJB.jar</bundleFileName>
                    </ejbModule>
                </modules>

            </configuration>
        </plugin>
    </plugins>
</build>

EAR manifest.mf:

Class-Path: WebInfoWeb.war WebInfoEJB.jar core_business-5.1.0.jar core
 _common-5.1.0.jar core-5.1.0.jar ICS_SSEClient-3.5.15.jar com.ibm.uti
 l.ini-1.0.jar ICS_SecuredUserContext-3.5.15.jar ICS_SecuredUserContex
 tClient-3.5.15.jar ICS_ManageClient-3.5.15.jar ICS_ConfigurationClien
 t-3.5.15.jar ICS_Common-3.5.15.jar

WAR manifest.mf:

Class-Path: WebInfoJava-3.9.0-SNAPSHOT.jar com.ibm.util.ini-1.0.jar ow
 asp-esapi-full-java-1.4.jar regexp-1.2.jar com.ibm.regex.REUtil-1.3.0
 .jar ojdbc6-11.2.0.3.0.jar AdobeFDF-1.0.jar core_business-5.1.0.jar c
 ore_common-5.1.0.jar core-5.1.0.jar ICS_SSEClient-3.5.15.jar ICS_Secu
 redUserContext-3.5.15.jar ICS_SecuredUserContextClient-3.5.15.jar ICS
 _ManageClient-3.5.15.jar ICS_ConfigurationClient-3.5.15.jar ICS_Commo
 n-3.5.15.jar

例外:

java.lang.ClassNotFoundException: com.calculator.sendmail.SendMailCommunicationBusinessFactory

SendMailCommunicationBusinessFactory位于WebInfoJava-3.9.0-SNAPSHOT.jar,位于war / WEB-INF / lib文件夹中。

我是否在设置/配置类路径时做错了什么?

0 个答案:

没有答案
相关问题