Tanvir
Tanvir

Reputation: 1522

JBoss EAP 6 cannot find JARs in APP-INF/lib

I am doing a migration from Weblogic to JBoss EAP 6.4 but I am having a problem deploying to and starting the JBoss server.

My EAR structure is as follows:

.EAR
|
|---APP-INF
|      |---lib
|           |---[many .jar files]
|
|---META-INF
|       |---application.xml
|       |---jboss-deployment-structure.xml
|
|---[EJB JAR files]

The problem:

The EJB JARs in the root of the EAR cannot access the classes in the JARs that are in the APP-INF/lib folder.

Upvotes: 2

Views: 2336

Answers (2)

Ondra Žižka
Ondra Žižka

Reputation: 46904

The APP-INF/lib location is specific to WebLogic. There are two solutions:

  • Make Maven build the app according to standards - /lib. That's what you did in your answer.

  • Since Java EE 5 you can include the library-directory parameter in your META-INF/application.xml file:

    <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
       <module>
          <ejb>hello-ejb.jar</ejb>
       </module>
       <module>
          <web>
         <web-uri>myapp.war</web-uri>
         <context-root>myapp</context-root>
          </web>
       </module>
       <library-directory>APP-INF/lib</library-directory>
    </application>
    

As an alternative, you can include the same parameter in your jboss-app.xml:

    <application>
      <display-name>My Application</display-name>
      <module>
        <web>
          <web-uri>myapp.war</web-uri>
          <context-root>/myapp</context-root>
        </web>
      </module>

      <module>
        <ejb>myapp.jar</ejb>
      </module>

      <library-directory>APP-INF/lib</library-directory>

    </application>

Upvotes: 1

Tanvir
Tanvir

Reputation: 1522

I manually put the lib folder at the root of the EAR instead of in the APP-INF folder and it seemed to do the trick.

JBoss was looking inside .EAR/lib instead of .EAR/APP-INF/lib

Then, I added the following in the maven-ear-plugin section in my pom.xml to get maven to create the lib folder at the root and not in APP-INF:

<plugin>
    <artifactId>maven-ear-plugin</artifactId>
    <version>2.9.1</version>
    <configuration>
        <defaultLibBundleDir>lib</defaultLibBundleDir>
        <goals>
            <goal>generate-application-xml</goal>
            <initializeInOrder>true</initializeInOrder>
        </goals>
    </configuration>
</plugin>

Upvotes: 1

Related Questions