Configuring EclipseLink as a module within JBoss is really a breeze and helps standardize the web applications that are deployed because this means that the eclipselink jar does not need to be contained within the web archive (war) file. Glassfish also does not require the eclipselink jar within the web archive unless the application requires a different version than the one supplied by the application server.

The first step is to create the directory structure under the module directory.

<JBOSS INSTALLATION>\modules\org\eclipse\persistence\main

Under the main directory create the module.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Represents the EclipseLink 2.3.x module-->
<module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence">
 <resource-root path="eclipselink-2.3.1.jar"/>
  <module name="asm.asm"/>
  <module name="javax.api"/>
  <module name="javax.persistence.api"/>
  <module name="javax.transaction.api"/>
  <module name="javax.validation.api"/>
  <module name="javax.xml.bind.api"/>
  <module name="org.antlr"/>
  <module name="org.apache.ant"/>
  <module name="org.apache.commons.collections"/>
  <module name="org.dom4j"/>
  <module name="org.javassist"/>
  <module name="org.jboss.logging"/>

Next copy the EclipseLink jar and make sure that the file name matches the resource-root node in the module.xml.

Although JBoss does auto detect dependencies it is always a good practice to explicitly declare these dependencies. This is done by including either a jboss-deployment-structure.xml or a MANIFEST.MF with the dependency declaration.

Here is a MANIFEST.MF example

Manifest-Version: 1.0
Created-By: Apache Maven
Dependencies: org.eclipse.persistence

Here is a jboss-deployment-structure.xml

      <module name="org.eclipse.persistence" />

The zip containing the EclipseLink module con be downloaded here.