I've got an EAR which contains a WAR and an EJB (jar). The EJB and the WAR share some libraries, so I wanted to produce a skinnyWar using maven-ear-plugin
.
I have my ear pom configured with the shared libs as dependencies, and have the <skinnyWars>
option set to true.
I see my EAR is properly built; the common libs are extracted from my WAR and placed in the EAR.
My problem, when I launch my EAR on Websphere 8.5, is that the WAR is unable to find classes which remain in the WAR/WEB-INF/lib folder.
I have checked the MANIFEST.MF in the war/META-INF/ and see that all the libs are listed (both those in the war/web-inf/lib folder as well as the common libs), however I keep getting ClassNotFoundException
whenever I try to access classes from within the WEB-INF/lib/xxx.jar.
(snippets from the 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
Exception:
java.lang.ClassNotFoundException: com.calculator.sendmail.SendMailCommunicationBusinessFactory
But SendMailCommunicationBusinessFactory
is located in WebInfoJava-3.9.0-SNAPSHOT.jar
which is in the war/WEB-INF/lib folder.
Am I doing something incorrect in the way the classpath is setup/configured?