Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basic ear-package deployment in JBoss

This is what I would like to achieve:

  • 1 ear-package: all.ear
  • The ear-package contains two war's (A.war, B.war in the root of the ear)
  • The ear-package contains 1 self-made jar C and a lot of third party jars (under APP-INF\lib)

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? ...?)

like image 369
Thomas Stubbe Avatar asked Jun 10 '26 23:06

Thomas Stubbe


1 Answers

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)

like image 55
Saikanth Avatar answered Jun 14 '26 16:06

Saikanth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!