How do I change the default lib directory in an ear file?

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

 

Supposing you have an Enterprise application which has been packaged in an ear and its libraries are placed in another folder like Weblogic's APP-INF/lib. How can I deploy this application to JBoss ? 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. Here's an example:

<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>

Related articles available on mastertheboss.com

How to configure JBoss to disable hot deployment ?

On JBoss AS 7 and WildFly the default rule is that archived appli

How do I make sure my MBean is deployed after my EJB ?

  If your MBean is dependant on another resource, supposing cont

How to let JBoss deploy an application after other apps?

  If you are running JBoss AS 7 or WildFly check the following t

How to deploy an application temporarly with JBoss ?

One way to do it, is using the jboss.system:service=MainDeployer

How to add a custom JBoss archive in an Ear ?

JBoss custom archives (like .sar or .har) are not recognized by t

JBoss deployment directory configuration

In this tutorial we are going to show how to provide an alternati

Follow us on Twitter