Reputation: 2005
This is what I would like to achieve:
This package needs to be deployed on JBoss WildFly 8.2.1
I'm using maven's ear plugin (maven-ear-plugin, version 2.10.1). My configuration in the pom looks like this (this is the 'parent'-project which combines three other projects):
<configuration>
<finalName>All</finalName>
<defaultLibBundleDir>APP-INF/lib</defaultLibBundleDir>
<includeLibInApplicationXml>true</includeLibInApplicationXml>
<version>6</version>
<displayName>All</displayName>
<modules>
<jarModule>
<groupId>project</groupId>
<artifactId>C</artifactId>
<bundleFileName>C.jar</bundleFileName>
<uri>APP-INF/lib/C.jar</uri>
<bundleDir>APP-INF/lib</bundleDir>
</jarModule>
<webModule>
<groupId>project</groupId>
<artifactId>A</artifactId>
<uri>A.war</uri>
<bundleFileName>A.war</bundleFileName>
<contextRoot>/a</contextRoot>
<bundleDir>/</bundleDir>
</webModule>
<webModule>
<groupId>project</groupId>
<artifactId>B</artifactId>
<uri>B.war</uri>
<bundleFileName>B.war</bundleFileName>
<contextRoot>/b</contextRoot>
<bundleDir>/</bundleDir>
</webModule>
</modules>
<archive>
<manifestEntries>
<Implementation-Version>1.0</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
My META.INF/application.xml file loos like this:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="6"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_6.xsd">
<display-name>All</display-name>
<initialize-in-order>true</initialize-in-order>
<module>
<java>APP-INF/lib/C.jar</java>
</module>
<module>
<web>
<web-uri>B.war</web-uri>
<context-root>b</context-root>
</web>
</module>
<module>
<web>
<web-uri>A.war</web-uri>
<context-root>a</context-root>
</web>
</module>
<library-directory>APP-INF/lib</library-directory>
</application>
The ear package is made. All third-party jars are under APP-INF/lib, but C.jar is in the root directory.
I have messed around a lot and got different errors when trying to upload the package to JBoss:
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS016703: Module may not be a child of the EAR's library directory. Library directory: APP-INF/lib, module file name: APP-INF/lib/[SomeThirthPartyLib].jar"
When I placed every library under root (don't use APP-INF), I've got a ClassNotFoundError for B.war (can't find the classes from C.jar).
I've already tried adding the 'jboss'-tags to the maven-ear-plugin (configuration), but those are not supported for JBoss 8+.
I want a .ear package which can be deployed in JBoss and contains 2 wars and 1 jar, which is referenced from both the wars.
What am I missing? (specific Manifest configuration? specific pom.xml settings for A, B or C? JBoss settings? ...?)
Upvotes: 3
Views: 2638
Reputation: 11
solution for the error "WFLYEE0097: Module may not be a child of the EAR's library directory": the error is becuase of tag APP-INF/lib in application.xml. If library jars are inside EAR/lib then application.xml will work fine Since it is under EAR/APP-INF/lib, jboss or wildfly will not understand this(appication.xml) deployment descriptor. So use jboss-app.xml which wildfly understands even if the library directory is different. Solution : Simply copy complete content of application.xml to jboss-app.xml and place it META-INF folder (Also make sure to delete application.xml file or not making this get generated through pom.xml)
Upvotes: 1
Reputation: 960
According to the JAVA EE specs, the container will not scan any deployment descriptors of any jar that is included in the library directory of the ear.
But what I presume you want to do is have access from the WARs to those ejb's you declared in C.jar. Again, according to specs, any ejb-jar sitting in an ear is visible to any other module:
Components in the web container may have access to the following classes and resources. Portable applications must not depend on having or not having access to these classes or resources.
•The classes and resources accessible to any other web modules included in the same ear file, as described above.
•The content of any EJB jar files included in the same ear file.
So, just put the C.jar anywhere else but in the lib directory and you're fine.
Upvotes: 0