Reputation: 1157
I am using maven to build applications.
I have deployed a WAR file containing many common jars as shared library in application server.
I have an artifact (say A-EJB) of packaging type EJB. I have built the ejb jar file.
I have an another artifact (say A-EAR) of packaging type EAR.
I have added A-EJB dependency in pom file of A-EAR. I could build the EAR file and for adding shared library reference, I have added library reference in weblogic-application.xml of EAR.
In my final EAR file, I could see A-EJB.jar file, other dependency jar files of A-EAR artifact.
EAR structure:
--------------APP-INF\lib\some jars
--------------META-INF\application.xml, MANIFEST.MF, weblogic-application.xml
--------------A-ejb.jar
The class files of A-EJB.jar requires reference of common jars in shared library.
Ideally, I am expecting the deployment should happen successfully but this is not happening. Even though I have shared library reference in EAR file, the deployment fails due to classNotFoundException while preparing the EJB module during deployment.
The class files of A-EJB.jar searches for required jar files for reference but they are available in shared library and shared library is not used even EAR file has the reference to it.
Exception:
weblogic.application.ModuleException: Exception preparing module: EJBModule [EJB:011023]An error occurred while reading the deployment descriptor. The error was: ...........................................................
Caused By: java.lang.ClassNotFoundException: ............................................................
So, this means even though EAR had a shared library reference, the ejb.jar present inside the EAR did not have reference to shared library. Is this true ?
Has anyone faced this exception and scenario. Kindly help me about resolving this issue.
Upvotes: 0
Views: 8467
Reputation: 1406
I suggest you to use the ear plugin with this settings.. might help..
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<modules>
<ejbModule>
<groupId>ur ejb</groupId>
<artifactId>ur ejb Id</artifactId>
</ejbModule>
<jarModule>
<groupId>......</groupId>
<artifactId>......</artifactId>
</jarModule>
....
....
Other jar modules to be included other than the one included in dependency tag
....
....
</modules>
<archive>
<manifest>
<addClasspath>false</addClasspath>
</manifest>
</archive>
<displayName>...name...</displayName>
<description>........desc.......</description>
</configuration>
</plugin>
Upvotes: 0