EclipseLink Solutions Guide for EclipseLink
Release 2.7
  Go To Table Of Contents

Implementing the Solution

To develop, deploy and run EclipseLink applications in JBoss Application Server 7, you must create EclipseLink as a module of JBoss. You must also create other modules, such as a JDBC driver, etc., in order to run applications.

This section contains the following tasks for using EclipseLink with JBoss 7.1:

Task 1: Prerequisites

Ensure that you have installed the following components:

Task 2: Configure EclipseLink as a Module in JBoss

To configure EclipseLink as a module in JBoss:

  1. Create a directory as follows:

    JBOSS_ HOME\modules\org\eclipse\persistence\main

  2. Copy eclipselink.jar to the directory created in step 1. (The eclipselink.jar file is located in the eclipselink/jlib directory of the file.)

  3. Create a module.xml file in the directory created in step 1, with the following content:

    <module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence">
           <resource-root path="eclipselink.jar"/>
           <!-- Insert resources here -->
          <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.commons.collections"/>
          <module name="org.dom4j"/>
          <module name="org.javassist"/>
          <module name="org.jboss.logging"/>
          <module name=""/>

Task 3: Add ojdbc6.jar as a Module in JBoss

Add the Oracle thin driver ojdbc6.jar as a module within JBoss, as follows:

  1. Create the module directory:

    JBOSS_ HOME\modules\com\oracle\ojdbc6\main

  2. Copy ojdbc6.jar to the module directory created in step 1.

  3. Create a module.xml file in the module directory created in step 1, with the following contents:

    <module xmlns="urn:jboss:module:1.1" name="">
            <resource-root path="ojdbc6.jar"/>
            <!-- Insert resources here -->
            <module name="javax.api"/>

Task 4: Create the Driver Definition and the Datasource

Create the driver definition and create the datasource.

The following instructions tell how to configure JBoss for running in standalome mode, using the standalone.xml configuration file. For instructions on how to use domain.xml to configure JBoss for running in domain mode, see the JBoss documentation.

  1. In the standalone configuration file JBOSS_ HOME\standalone\configuration\standalone.xml, find the following:

    <subsystem xmlns="urn:jboss:domain:datasources:1.0">

  2. In that section, configure the datasource. The following example shows a configuration for the Oracle Database, using the Oracle JDBC Thin driver. For instructions on configuring other datasources, see the JBoss documentation.

<subsystem xmlns="urn:jboss:domain:datasources:1.0">
      <datasource jndi-name="java:/EclipseLinkDS" 
       <driver name="oracle" module="">

Task 5: Create Users

Starting with JBoss Application Server 7.1, you must create an Application User to get started, because remote access to the JNDI tree is secured by default, and you must provide login credentials. Therefore, at a minimum, you just create an Application User to be able to deploy an application to the server. If you want to use the JBoss administration console for administration tasks, for example to view the JNDI tree, you must also create an Administration User.

To create user credentials, use the JBoss add-user.bat utility, located in JBOSS_HOME\bin\.

For more information about security in JBoss Application Server, refer to the JBoss documentation.

Task 6: Modify JBoss Properties

Modify JBoss properties, as follows:

## JBoss-7.x

Task 7: Other Requirements

  1. Add junit.jar in the ear under the \lib directory.

  2. Because of a classloading issue in JBoss, you must list all your entity classes in persistence.xml. You can use either <class> elements or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.

  3. Add both and in the client classpath.

Task 8: Start JBoss

Start JBoss by running standalone.bat (for a single-server configuration) or domain.bat file (in a clustered environment) in JBOSS_ HOME\bin\.

For information on different ways to configure and start JBoss, see the JBoss documentation.