Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Integrating EclipseLink with an Application Server (ELUG)"

m
m
 
(134 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
[[Image:Elug draft icon.png]] '''For the latest EclipseLink documentation, please see http://www.eclipse.org/eclipselink/documentation/ '''
 +
 +
----
 +
 
<div style="float:right;border:1px solid #000000;padding:5px">__TOC__
 
<div style="float:right;border:1px solid #000000;padding:5px">__TOC__
 
[[Special:Whatlinkshere/Integrating EclipseLink with an Application Server (ELUG)|Related Topics]]</div>
 
[[Special:Whatlinkshere/Integrating EclipseLink with an Application Server (ELUG)|Related Topics]]</div>
Line 11: Line 15:
  
 
==Introduction to the Application Server Support==
 
==Introduction to the Application Server Support==
EclipseLink can be used with any Java EE application server.
+
EclipseLink can be used with ''any'' Java EE application server that meets the [[#What Are the Software Requirements|software requirements]] through the EclipseLink API.  
 +
 
 +
There is EclipseLink-specific integration support for the following servers:
 +
* [[#Integrating EclipseLink with Oracle WebLogic Server|Oracle WebLogic Server]]
 +
* [[#Integrating EclipseLink with Oracle Containers for J2EE (OC4J)|Oracle Containers for J2EE (OC4J)]]
 +
* [[#Integrating EclipseLink with IBM WebSphere Application Server|IBM WebSphere Application Server]]
 +
* [[#Integrating EclipseLink with Sun Application Server|Sun Application Server]]
 +
* [[#Integrating EclipseLink with JBoss Application Server|JBoss Application Server]]
 +
* [[#Integrating EclipseLink with SAP NetWeaver Application Server|SAP NetWeaver Application Server]]
  
For more information, see the following:
 
* [[#Integrating EclipseLink with Oracle Containers for J2EE (OC4J)|Integrating EclipseLink with Oracle Containers for J2EE (OC4J)]]
 
* [[#Integrating EclipseLink with BEA WebLogic Server|Integrating EclipseLink with BEA WebLogic Server]]
 
* [[#Integrating EclipseLink with IBM WebSphere Application Server|Integrating EclipseLink with IBM WebSphere Application Server]]
 
* [[#Integrating EclipseLink with Sun Application Server|Integrating EclipseLink with Sun Application Server]]
 
* [[#Integrating EclipseLink with JBoss Application Server|Integrating EclipseLink with JBoss Application Server]]
 
  
  
Line 37: Line 43:
 
* A JDBC driver configured to connect with your local database system (for more information, see your database administrator);
 
* A JDBC driver configured to connect with your local database system (for more information, see your database administrator);
 
* A Java development environment, such as the following:
 
* A Java development environment, such as the following:
** Eclispe IDE;
+
** Eclipse IDE;
 
** Oracle JDeveloper;
 
** Oracle JDeveloper;
 
** IBM WebSphere Studio Application Developer (WSAD);
 
** IBM WebSphere Studio Application Developer (WSAD);
Line 77: Line 83:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
<tt>org.eclipse.persistence.platform.xml.xdk.XDKPlatform</tt><sup>1 </sup>
+
<tt>org.eclipse.persistence.platform.xml.xdk.XDKPlatform</tt>
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
<tt>XDKParser</tt><nowiki>: this class provides access to the Oracle XML Developer's Kit (XDK) XML parser (see </nowiki><tt>http://www.oracle.com/technology/tech/xml/xdkhome.html</tt>).
 
<tt>XDKParser</tt><nowiki>: this class provides access to the Oracle XML Developer's Kit (XDK) XML parser (see </nowiki><tt>http://www.oracle.com/technology/tech/xml/xdkhome.html</tt>).
Line 84: Line 90:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
<tt>org.eclipse.persistence.platform.xml.jaxp.JAXPPlatform</tt>
+
<tt>org.eclipse.persistence.platform.xml.jaxp.JAXPPlatform</tt><sup>1 </sup>
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
<tt>JAXPParser</tt><nowiki>: this class provides access to the Java SDK XML parser in the </nowiki><tt>javax.xml.parsers</tt> package (see <tt>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPIntro2.html</tt>).
 
<tt>JAXPParser</tt><nowiki>: this class provides access to the Java SDK XML parser in the </nowiki><tt>javax.xml.parsers</tt> package (see <tt>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPIntro2.html</tt>).
 
| headers="r3c1-t2 r1c3-t2" align="left" |
 
| headers="r3c1-t2 r1c3-t2" align="left" |
 
See the following:
 
See the following:
* [[#Integrating EclipseLink with BEA WebLogic Server|Integrating EclipseLink with BEA WebLogic Server]]
+
* [[#Integrating EclipseLink with Oracle WebLogic Server|Integrating EclipseLink with Oracle WebLogic Server]]
 
* [[#Integrating EclipseLink with IBM WebSphere Application Server|Integrating EclipseLink with IBM WebSphere Application Server]]
 
* [[#Integrating EclipseLink with IBM WebSphere Application Server|Integrating EclipseLink with IBM WebSphere Application Server]]
 
|}
 
|}
  
<br /><sup>Footnote 1 </sup>Default:<br /><br />
+
<br /><sup>1 </sup>Default.<br /><br />
  
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
Line 111: Line 117:
  
 
====Creating an XML Parser Platform====
 
====Creating an XML Parser Platform====
Using the <tt>org.eclipse.persistence.internal.xml</tt> classes you can create your own instance of the <tt>org.eclipse.persistence.platform.xml.XMLPlatform</tt> class to specify an XML parser not listed in [[#table_7_1|Supported XML Platforms]].
+
Using the <tt>org.eclipse.persistence.internal.xml</tt> classes you can create your own instance of the <tt>org.eclipse.persistence.platform.xml.XMLPlatform</tt> class to specify an XML parser not listed in the [[#table_7_1|Supported XML Platforms]] table.
  
 
After creating your <tt>XMLPlatform</tt>, configure EclipseLink to use it (see [[#Configuring XML Parser Platform|Configuring XML Parser Platform]]).
 
After creating your <tt>XMLPlatform</tt>, configure EclipseLink to use it (see [[#Configuring XML Parser Platform|Configuring XML Parser Platform]]).
Line 127: Line 133:
 
* Ensure that your XML files use a fully qualified system identifier URL.
 
* Ensure that your XML files use a fully qualified system identifier URL.
 
* Use another XML parser (such as the OracleAS XML Parser for Java v2).
 
* Use another XML parser (such as the OracleAS XML Parser for Java v2).
 
  
  
Line 136: Line 141:
  
 
If you run a EclipseLink-enabled application in a JVM without a nondefault <tt>SecurityManager</tt>, you do not need to set any permissions.
 
If you run a EclipseLink-enabled application in a JVM without a nondefault <tt>SecurityManager</tt>, you do not need to set any permissions.
 
  
  
Line 144: Line 148:
 
To use EclipseLink with an application server cluster, use this general procedure:
 
To use EclipseLink with an application server cluster, use this general procedure:
 
# Install the <tt>eclipselink.jar</tt> file (and include it in the classpath) on each application server in the cluster to which you deploy EclipseLink applications.
 
# Install the <tt>eclipselink.jar</tt> file (and include it in the classpath) on each application server in the cluster to which you deploy EclipseLink applications.
# Configure EclipseLink cache consistency options appropriate for your application.For more information, see [[Introduction%20to%20Cache%20(ELUG)|Introduction to Cache]].
+
# Configure EclipseLink cache consistency options appropriate for your application.<br>For more information, see [[Introduction%20to%20Cache%20(ELUG)|Introduction to Cache]].
# Configure EclipseLink coordinated cache support for your application server, if available.For more information, see [[#How to Integrate with Oracle Application Server Clustering|How to Integrate with Oracle Application Server Clustering]].
+
# Configure clustering on each application server.<br>For more information, see your application server documentation.
# Configure clustering on each application server.For more information, see your application server documentation.
+
  
  
  
==Integrating EclipseLink with Oracle Containers for J2EE (OC4J)==
 
To integrate a EclipseLink application with OC4J, you must consider the following:
 
* [[#How to Integrate JTA|How to Integrate JTA]]
 
* [[#How to Integrate JMX|How to Integrate JMX]]
 
* [[#How to Integrate with Oracle Application Server Clustering|How to Integrate with Oracle Application Server Clustering]]
 
* [[#How to Integrate with Oracle Application Server MaD|How to Integrate with Oracle Application Server MaD]]
 
  
In addition to configuring these OC4J specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
+
==Integrating EclipseLink with Oracle WebLogic Server==
 +
To integrate an EclipseLink application with Oracle WebLogic Server, you must consider the following:
 +
* [[#How to Configure the WebLogic Classpath|How to Configure the WebLogic Classpath]]
 +
* [[#How to Integrate with the WebLogic JTA|How to Integrate with the WebLogic JTA]]
 +
<!--* [[#How to Integrate JMX|How to Integrate JMX]]-->
 +
* [[#How to Integrate the Security Manager|How to Integrate the Security Manager]]
 +
 
 +
In addition to configuring these Oracle WebLogic Server-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
 +
 
  
 +
===How to Configure the WebLogic Classpath===
 +
EclipseLink works out of the box in Oracle WebLogic Server 10.3. The EclipseLink library resides in the following location on the server:
 +
$BEA_HOME/modules/org.eclipse.persistence_*.jar
  
 +
Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
  
===How to Integrate JTA===
+
===How to Integrate with the WebLogic JTA===
 
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]]).
 
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]]).
  
 
For more information, see [[Using%20Advanced%20Unit%20of%20Work%20API%20(ELUG)#Integrating the Unit of Work with an External Transaction Service|Integrating the Unit of Work with an External Transaction Service]].
 
For more information, see [[Using%20Advanced%20Unit%20of%20Work%20API%20(ELUG)#Integrating the Unit of Work with an External Transaction Service|Integrating the Unit of Work with an External Transaction Service]].
 
 
  
 
===How to Integrate JMX===
 
===How to Integrate JMX===
By default, when you deploy a EclipseLink application to OC4J, the EclipseLink runtime deploys the following Java Management Extensions (JMX) MBeans to the OC4J JMX service for each EclipseLink session:
+
By default, when you deploy an EclipseLink application to Oracle WebLogic Server, the EclipseLink runtime deploys the following Java Management Extensions (JMX) MBeans to the Oracle WebLogic Server JMX service for each EclipseLink session:
* <tt>Oc4jRuntimeServices</tt><nowiki>: This class is meant to provide facilities for managing a EclipseLink session external to EclipseLink over JMX.</nowiki>
+
* <tt>org.eclipse.persistence.services.DevelopmentServices</tt> - This class is meant to provide facilities for managing an EclipseLink session internal to EclipseLink over JMX.
* <tt>Oc4jRuntime</tt> implements <tt>Oc4jRuntimeMXBean</tt><nowiki>: This class is meant to provide facilities for managing a EclipseLink session external to EclipseLink over JMX.</nowiki>
+
* <tt>org.eclipse.persistence.services.RuntimeServices</tt> - This class is meant to provide facilities for managing an EclipseLink session external to EclipseLink over JMX.
 
+
These classes are from the <tt>org.eclipse.persistence.services.oc4j package</tt>.
+
 
+
Use the API that these JMX MBeans expose to access and configure your EclipseLink sessions at runtime using JMX code that you write or to integrate your EclipseLink application with a third-party JMX management application, such as Oracle Enterprise Manager 10''g'' Application Server Control, <tt>jconsole</tt>, or others.
+
 
+
  
 +
Use the API that this JMX MBean exposes to access and configure your EclipseLink sessions at run time using JMX code that you write, or to integrate your EclipseLink application with a third-party JMX management application, such as JConsole.
  
 +
====Setting Up the Environment for EclipseLink JMX MBeans====
 +
Perform the following steps:
 +
# '''Set breakpoints:''' the <tt>eclipselink.jar</tt> deployed in the <tt>$WEBLOGIC_HOME/modules/org.eclipse.persistence_n.n.n.jar</tt> needs a source attachment. You set a breakpoint on the <tt>undeploy</tt> method of the <tt>org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl</tt> pointing to the source JAR file or your workspace projects, and then redeploy. This will result in any breakpoints set in the <tt>predeploy</tt> method or prior to the first login to be hit.
 +
# '''Enable remote access on the Oracle WebLogic Server JVM''' by adding the following JVM option to your WebLogic startup script:<br><tt>C:\opt\wls103\user_projects\domains\base_domain\bin\startWebLogic.cmd</tt><br><tt>set JAVA_OPTIONS=%JAVA_OPTIONS% -Dcom.sun.management.jmxremote</tt>
 +
# '''Enable MBean registration (deployment)''' by adding one or both of the two MBean system properties, as follows:<br><tt>rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.dev.mbean=true</tt><br><tt>rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.run.mbean=true</tt><br>By default, EclipseLink does not register MBeans for Oracle WebLogic Server. If you enable the registration, it will occur as a post step during the first login to the session (see [[Configuring%20a%20Session%20(ELUG)#Configuring a Session Login|Configuring a Session Login]]).<br>If both <tt>eclipselink.register.dev.mbean</tt> and <tt>eclipselink.register.run.mbean</tt> properties are missing, MBean registration will not proceed for that bean.
 +
# '''Configure Oracle WebLogic Server domain security'''.<br>For more information, see ''[http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial EclipseLink JMX MBean Support in Oracle WebLogic Server tutorial]''.
 +
<!--
 
====Confirming that EclipseLink JMX MBeans are Deployed====
 
====Confirming that EclipseLink JMX MBeans are Deployed====
Before you access EclipseLink JMX MBeans, you can use various methods to determine whether or not they were successfully deployed in OC4J.
+
Before you access EclipseLink JMX MBeans, you can use various methods to determine whether or not they were successfully deployed in Oracle WebLogic Server.
  
 
'''To confirm that EclipseLink JMX MBeans are deployed:'''
 
'''To confirm that EclipseLink JMX MBeans are deployed:'''
 +
# Package and deploy your EclipseLink application to Oracle WebLogic Server.<br>For more information, see [[Deploying%20a%20EclipseLink%20Application%20(ELUG)|Deploying an EclipseLink Application]].
 +
# Examine Oracle WebLogic Server logs and look for the appropriate log messages. Note that for a JPA application, EclipseLink session instantiation and login occurs at <tt>EntityManager</tt> instantiation time.
 +
# Use the System MBean Browser in the Oracle Enterprise Manager Fusion Middleware Control to access the EclipseLink JMX MBeans.<br>For more information, see [[#Accessing EclipseLink JMX MBeans Using Oracle Enterprise Manager Fusion Middleware Control|Accessing EclipseLink JMX MBeans Using Oracle Enterprise Manager Fusion Middleware Control]].
  
# Package and deploy your EclipseLink application to OC4J.For more information, see [[EclipseLink/UserGuide/Overview of EclipseLink Application Deployment (ELUG)|EclipseLink Application Deployment]].
+
====Accessing EclipseLink JMX MBeans Using Oracle Enterprise Manager Fusion Middleware Control====
# Examine OC4J logs and look for the appropriate log messages.
+
After you deploy your EclipseLink application, you can use the System MBean Browser in the Oracle Enterprise Manager Fusion Middleware Control to access and use a subset of the public API that EclipseLink MBeans provide.
## For a JPA application, EclipseLink session instantiation and login occurs at <tt>EntityManager</tt> instantiation time.<br><span id="Example 7-2"></span>''''' EclipseLink JMX MBean Deployment Log Messages: JPA Application''''' <br> TBD
+
# Use the System MBean Browser in the Oracle Enterprise Manager 10''g'' Application Server Control to access the EclipseLink JMX MBeans.For more information, see [[#Accessing EclipseLink JMX MBeans Using Oracle Enterprise Manager 10g Application Server Control|Accessing EclipseLink JMX MBeans Using Oracle Enterprise Manager 10g Application Server Control]].
+
 
+
 
+
 
+
====Accessing EclipseLink JMX MBeans Using Oracle Enterprise Manager 10''g'' Application Server Control====
+
After you deploy your EclipseLink application, you can use the System MBean Browser in the Oracle Enterprise Manager 10''g'' Application Server Control to access and use a subset of the public API that EclipseLink MBeans provide.
+
 
+
'''To access EclipseLink JMX MBeans using Oracle Enterprise Manager 10''g'' Application Server Control:'''
+
<ol>
+
<li> Package and deploy your EclipseLink application to OC4J.For more information, see [[EclipseLink/UserGuide/Overview of EclipseLink Application Deployment (ELUG)|Introduction to EclipseLink Application Deployment]].</li>
+
<li> Determine the http port for the <tt>oc4j_admin</tt> instance using the following <tt>asctl</tt> command on the computer on which the <tt>oc4j_admin</tt> instance is running:
+
<div class="pre">
+
$ asctl getports ''<tt>ORACLE_INSTANCE_NAME</tt>''/oc4j_admin/http-web-site
+
    Oracle Fusion Middleware Administration Server Release 11.1.1.0.0
+
 
+
      --------------------------------------------------------
+
    | Name      | Dps Id    | Port      | Ip Address| Port Status |
+
    |          |          |          |          |            |
+
    | http-web-site| /farm1_FarmRoot/farm1/asinst_1/oc4j_admin/http-web-site| 6799      | 10.1.2.3| READY      |
+
      --------------------------------------------------------
+
</div><br>Where ''<tt>ORACLE_INSTANCE_NAME</tt>'' is the name of the Oracle instance that hosts <tt>oc4j_admin</tt>. In this example, the ''<tt>ORACLE_INSTANCE_NAME</tt>'' is <tt>asinst_1</tt> and the http port for the <tt>oc4j_admin</tt> instance is 6799.For more information, see ''Oracle Fusion Middleware Administration and Application Deployment Guide for Oracle Containers for Java EE''.</li>
+
<li> Log into the Application Server Control Console by launching a Web browser and entering a URL like: <br><tt>http://''HOST_NAME''<nowiki>:</nowiki>''PORT''/em/faces/targetauth/emasLogin</tt>
+
:Where ''<tt>HOST_NAME</tt>'' is the host name or IP address of the computer on which the <tt>oc4j_admin</tt> instance is running and ''<tt>PORT</tt>'' is the http port for the <tt>oc4j_admin</tt> instance from step 2.</li>
+
<li> In the navigator, click on the '''Farm''' tab pull-down menu and select '''Administration''' and then select '''System MBean Browser'''.</li>
+
<li> On the System MBean Browser page, expand the '''Search''' menu and select '''MBean Name'''.</li>
+
<li> Enter your EclipseLink session or application name in the search field and click the '''Search''' button.The Application Server Control Console finds all the MBeans associated with your EclipseLink session or application.[[#Figure 7-1|Application Server Control Console System MBean Browser]] shows the MBeans for a EclipseLink application named <tt>jpa-example</tt>.<br>'''''Application Server Control Console System MBean Browser'''''<br>[[Image:mbean.gif|Application Server Control Console System MBean Browser]]<br /><br /></li>
+
<li> Select an MBean and use the '''Attributes''', '''Operations''', and '''Notifications''' tabs to access attributes, invoke operations, and examine MBEan notifications.Application Server Control Console gives you access to a subset of the public API of the <tt>Oc4jRuntimeServices</tt> and <tt>Oc4Runtime</tt> MBeans.</li></ol>
+
 
+
  
 +
'''To access EclipseLink JMX MBeans using Oracle Enterprise Manager Fusion Middleware Control:'''
 +
* 1. Package and deploy your EclipseLink application to Oracle WebLogic Server.<br>For more information, see [[Deploying%20a%20EclipseLink%20Application%20(ELUG)|Deploying an EclipseLink Application]].
 +
* 2. Determine the HTTP port for the <tt>wls_admin</tt> component using the following <tt>asctl</tt> command on the computer on which the <tt>wls_admin</tt> component is running:
 +
$ asctl getports ORACLE_INSTANCE_NAME/wls_admin/http-web-site
 +
   
 +
    --------------------------------------------------------
 +
    | Name      | Dps Id    | Port      | Ip Address| Port Status |
 +
    |          |          |          |          |            |
 +
    | http-web-site| /farm1_FarmRoot/farm1/asinst_1/wls_admin/http-web-site|6799|10.3| READY|
 +
    --------------------------------------------------------
 +
Where <tt>ORACLE_INSTANCE_NAME</tt> is the name of the Oracle instance that hosts <tt>wls_admin</tt>. In this example, the <tt>ORACLE_INSTANCE_NAME</tt> is <tt>asinst_1</tt>, and the HTTP port for the <tt>wls_admin</tt> component is 6799.<br>For more information, see ''Oracle Fusion Middleware Administration and Application Deployment Guide for Oracle WebLogic Server''.
 +
* 3. Log in to the Fusion Middleware Control Console by launching a Web browser and entering a URL like:
 +
http://HOST_NAME:PORT/em/faces/targetauth/emasLogin
 +
Where <tt>HOST_NAME</tt> is the host name or IP address of the computer on which the <tt>wls_admin</tt> component is running, and <tt>PORT</tt> is the HTTP port for the <tt>wls_admin</tt> component from step 2.
 +
* 4. In the navigator, click on the '''Farm''' tab pull-down menu and select '''Administration''', and then select '''System MBean Browser'''.
 +
* 5. On the System MBean Browser page, expand the '''Search''' menu and select '''MBean Name'''.
 +
* 6. Enter your EclipseLink session or application name in the search field, and then click '''Search'''.<br>The Fusion Middleware Control Console finds all the MBeans associated with your EclipseLink session or application.<br>The following figure shows the MBeans for an EclipseLink application. <<figure goes below>>
 +
* 7. Select a MBean and use the '''Attributes''', '''Operations''', and '''Notifications''' tabs to access attributes, invoke operations, and examine MBean notifications.<br>Fusion Middleware Control Console gives you access to a subset of the public API of the <tt>RuntimeServices</tt> MBeans.
 +
-->
  
 
====Accessing EclipseLink JMX MBeans Using a Third-Party JMX Management Application====
 
====Accessing EclipseLink JMX MBeans Using a Third-Party JMX Management Application====
 
After you deploy your EclipseLink application, you can use any JMX-compliant management application to access and use the full public API that EclipseLink MBeans provide.
 
After you deploy your EclipseLink application, you can use any JMX-compliant management application to access and use the full public API that EclipseLink MBeans provide.
 
  
 
'''To access EclipseLink JMX MBeans using a third-party JMX management application:'''
 
'''To access EclipseLink JMX MBeans using a third-party JMX management application:'''
<ol>
+
# Package and deploy your EclipseLink application to Oracle WebLogic Server.<br>For more information, see [[Deploying%20a%20EclipseLink%20Application%20(ELUG)|Deploying an EclipseLink Application]].
<li> Package and deploy your EclipseLink application to OC4J.For more information, see [[Introduction to EclipseLink Application Development (ELUG)]].</li>
+
# Optionally, examine Oracle WebLogic Server logs and look for the appropriate log messages. Note that for a JPA application, EclipseLink session instantiation and login occurs at <tt>EntityManager</tt> instantiation time.  
<li> Optionally, confirm that EclipseLink JMX MBeans are deployed using Oracle Enterprise Manager 10''g'' Application Server Control.For more information, see [[#Accessing EclipseLink JMX MBeans Using Oracle Enterprise Manager 10g Application Server Control|Accessing EclipseLink JMX MBeans Using Oracle Enterprise Manager 10g Application Server Control]].</li>
+
# Launch your third-party JMX management application.<br>For example, launch JConsole (<tt>JDK_HOME\bin\jconsole.exe</tt>) using the command prompt, and then select the running <tt>weblogic.Server</tt> local process, as the following figure shows.<br><br>[[Image:Jconsole_attach_to_weblogic_server_jvm.jpg]]<br><br>  
<li> Configure your third-party JMX management application classpath to include:
+
* ''<tt>ORACLE_HOME</tt>''<tt>/dms/lib/dms.jar</tt>
+
* ''<tt>ORACLE_HOME</tt>''<tt>/j2ee/home/lib/adminclient.jar</tt>
+
* ''<tt>ORACLE_HOME</tt>''<tt>/j2ee/home/lib/javax77.jar</tt>
+
* ''<tt>ORACLE_HOME</tt>''<tt>/j2ee/home/oc4jclient.jar</tt></li>
+
<li> Launch your third-party JMX management application.For example, launch <tt>JDK_HOME</tt><tt>\bin\jconsole.exe</tt> using the batch file that the following figure shows.<br><span id="Example 7-3"></span>''''' Batch File for jconsole''''' <div class="pre">
+
ORACLE_HOME=C:\app-servers\OraHome-oc4j-101330
+
JAVA_HOME="C:\Program Files\Java\jdk1.5.0_06"
+
 
+
J2EE_HOME=%ORACLE_HOME%\j2ee\home
+
PATH=%JAVA_HOME%\bin;%PATH%
+
CLASSPATH=.;%JAVA_HOME%\lib\jconsole.jar;%JAVA_HOME%\lib\tools.jar;%J2EE_HOME%\lib\jms.jar;%J2EE_HOME%\lib\jndi.jar;%J2EE_HOME%\oc4jclient.jar;%J2EE_HOME%\lib\javax77.jar;%ORACLE_HOME%\j2ee\home\lib\adminclient.jar;%ORACLE_HOME%\lib\dms.jar
+
 
+
REM OC4J Standalone
+
%JAVA_HOME%\bin\jconsole -J-Djava.class.path=%CLASSPATH% -J-Dcom.sun.management.jmxremote.ssl=false -J-Dcom.sun.management.jmxremote.authenticate=true -J-Djmx.remote.protocol.provider.pkgs=oracle.oc4j.admin.jmx.remote "service:jmx:rmi://localhost:23791"
+
</div>
+
</li>
+
<li> Establish a connection to the OC4J JMX service using one of the following JMX URLs:
+
* Stand-alone OC4J:<tt>service:jmx:rmi://</tt>''<tt>OC4J_HOST</tt>''<tt><nowiki>:</nowiki></tt>''<tt>OC4J_PORT</tt>''
+
* Oracle Application Server:<tt>service:jmx:rmi:///opmn://</tt>''<tt>OPMN_HOST</tt>''<tt><nowiki>:</nowiki></tt>''<tt>OPMN_PORT</tt>''<tt>/</tt>''<tt>OC4J_NAME</tt>''
+
[[#Figure 7-2|Connection Configuration for jconsole]] shows how to create a <tt>jconsole</tt> connection to the OC4J JMX service for a stand-alone OC4J.<br><span id="Figure 7-2"></span>''''' Connection Configuration for jconsole'''''<br>[[Image:jconsoleconnect.gif|Connection Configuration for jconsole]]<br /><br /></li>
+
<li> Use your third-party JMX management application to examine EclipseLink MBean attributes, operations, and notifications.Using jconsole or JMX code you write, you can access the full public API of the <tt>Oc4jRuntimeServices</tt> and <tt>Oc4Runtime</tt> MBeans.[[#Figure 7-3|MBean Display for jconsole]] shows the <tt>jconsole</tt> display for a EclipseLink application named <tt>jpa-example</tt>.<br><span id="Figure 7-3"></span>''''' MBean Display for jconsole'''''<br>[[Image:jconsolembeans.gif|MBean Display for jconsole]]<br /><br /></li>
+
</ol>
+
  
 +
<!-- # Establish a connection to the Oracle WebLogic Server JMX service using the following JMX URL:<br><tt>service:jmx:rmi:///opmn://OPMN_HOST:OPMN_PORT/WLS_NAME</tt><br>The following figure shows how to create a JConsole connection to the Oracle WebLogic Server JMX service. -->
 +
<!--
 +
# Use your third-party JMX management application to examine EclipseLink MBean attributes, operations, and notifications.<br>Using JConsole or JMX code you write, you can access the full public API of the <tt>RuntimeServices</tt> MBeans.<br>The following figure shows the JConsole display for an EclipseLink application.<br><br>[[Image:Eclipselink_jmx_mbeans_in_jconsole.jpg]]<br><br>
 +
Notice the EclipseLink MBeans off the root of the JNDI tree. The preceding example contains two separate EAR files deployed to Oracle WebLogic Server, each with its own set of MBeans based on the login session.
 +
-->
 +
# Optionally, launch JRockit Mission Control '''JMC.exe''', attach to the JVM process and navigate to the MBeans tab - you will see the following screen showing the EclipsLink MBeans for your session.
 +
[[Image:Jrockit_jconsole_mbeans_via_non_jndi_generic_spec_lookup.JPG]]
  
 +
====Disabling EclipseLink JMX Support====
 +
There are a number of ways to disable EclipseLink JMX support.
  
====Disabling EclipseLink JMX Support Using Deployment XML====
+
'''To disable deployment of MBeans to Oracle WebLogic Server for your EclipseLink application using system properties''', remove, disable, or do not add in the first place <tt>eclipselink.register.dev.mbean</tt> and <tt>eclipselink.register.run.mbean</tt> MBean system properties. The following example shows how to disable these properties:<br><tt>rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.dev.mbean=false</tt><br><tt>rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.run.mbean=false</tt>.
By default, EclipseLink deploys MBeans to OC4J. To disable this feature for a EclipseLink application that includes a EclipseLink <tt>sessions.xml</tt> file, you can use this deployment XML file to disable EclipseLink JMX support. If your application does not include a EclipseLink <tt>sessions.xml</tt> file, you can use a <tt>preLogin</tt> event handler to disable this feature instead (see [[#Disabling EclipseLink JMX Support Using a preLogin Event Handler|Disabling EclipseLink JMX Support Using a preLogin Event Handler]]).
+
  
'''To disable EclipseLink JMX support using deployment XML:'''
 
  
# Undeploy your EclipseLink application on OC4J.
+
'''To disable deployment of MBeans to Oracle WebLogic Server for your EclipseLink application using deployment XML''', use an EclipseLink <tt>sessions.xml</tt> file (assuming your application has one):
# Edit your EclipseLink application's OC4J platform to disable runtime services.For more information, see [[Configuring%20a%20Session%20(ELUG)|Configuring the Server Platform]].
+
# Undeploy your EclipseLink application on Oracle WebLogic Server.
# Package your EclipseLink application and re-deploy on OC4J.For more information, see [[EclipseLink/UserGuide/Overview of EclipseLink Application Deployment (ELUG)|EclipseLink Application Deployment]]
+
# Edit your EclipseLink application’s Oracle WebLogic Server platform to disable run-time services.<br>For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]].
# Confirm that EclipseLink JMX MBean instances for your application no longer exist.For more information, see [[#Confirming that EclipseLink JMX MBeans are Deployed|Confirming that EclipseLink JMX MBeans are Deployed]].
+
# Package your EclipseLink application and redeploy on Oracle WebLogic Server.<br>For more information, see [[Deploying%20a%20EclipseLink%20Application%20(ELUG)|Deploying an EclipseLink Application]].
 +
# Confirm that EclipseLink JMX MBean instances for your application no longer exist.
  
 +
If your application does not include an EclipseLink <tt>sessions.xml</tt> file, you can use a <tt>preLogin</tt> event handler to disable this feature (see the following section).
  
  
====Disabling EclipseLink JMX Support Using a preLogin Event Handler====
+
'''To disable deployment of MBeans to Oracle WebLogic Server for your EclipseLink application using the EclipseLink session preLogin event handler''':
By default, EclipseLink deploys MBeans to OC4J. To disable this feature for a EclipseLink application that does not include a EclipseLink <tt>sessions.xml</tt> file (such as a EclipseLink JPA application), you can use a EclipseLink event handler to disable EclipseLink JMX support during the EclipseLink session <tt>preLogin</tt> event. If your application does include a EclipseLink <tt>sessions.xml</tt> file, you can use it to disable this feature instead (see [[#Disabling EclipseLink JMX Support Using Deployment XML|Disabling EclipseLink JMX Support Using Deployment XML]]).
+
 
+
 
+
'''To disable EclipseLink JMX support using a preLogin event handler:'''
+
 
<ol>
 
<ol>
<li> Undeploy your EclipseLink application on OC4J.</li>
+
<li> Undeploy your EclipseLink application on Oracle WebLogic Server.
<li> Create a EclipseLink session customizer.For more information, see [[Configuring%20a%20Session%20(ELUG)|Configuring a Session Customizer Class]].</li>
+
<li> Create an EclipseLink session customizer.<br>For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring a Session Customizer Class|Configuring a Session Customizer Class]].
<li> In your session customizer, create a session event listener for the <tt>preLogin</tt> session event and register the listener with the session event manager as this example shows.<br><span id="Example 7-4"></span>''''' EclipseLink Session Customizer with Session Event Listener'''''
+
<li> In your session customizer, create a session event listener for the <tt>preLogin</tt> session event and register the listener with the session event manager, as the following example shows.
 
<div class="pre">
 
<div class="pre">
  import <tt>org.eclipse.persistence.tools.sessionconfiguration.SessionCustomizer</tt><nowiki>;
+
  <tt>import oracle.eclipselink.tools.sessionconfiguration.SessionCustomizer;</tt>
  import org.eclipse.persistence.sessions.Session;
+
  <tt>import oracle.eclipselink.sessions.Session;</tt>
  import org.eclipse.persistence.sessions.SessionEvent;
+
  <tt>import oracle.eclipselink.sessions.SessionEvent;</tt>
  import org.eclipse.persistence.sessions.SessionEventAdapter;
+
  <tt>import oracle.eclipselink.sessions.SessionEventAdapter;</tt>
  import org.eclipse.persistence.platform.server.ServerPlatform;
+
  <tt>import oracle.eclipselink.platform.server.ServerPlatform;</tt>
   
+
  <tt>public class EmployeeSessionCustomizer implements SessionCustomizer {</tt>
public class EmployeeSessionCustomizer implements SessionCustomizer {
+
 
+
  <tt>public void customize(Sesssion session) {</tt>
    public void customize(Sesssion session) {
+
      <tt>SessionEventAdapter myEventListener = new SessionEventAdapter() {</tt>
        SessionEventAdapter myEventListener = new SessionEventAdapter() {
+
          <tt>'''// Listen for preLogin event'''</tt>
            </nowiki>'''// Listen for preLogin event'''
+
          <tt>public void preLogin(SessionEvent event) {</tt>
+
              <tt>'''// Disable runtime services'''</tt>
            public void preLogin(SessionEvent event) {
+
              <tt>Session session event.getSession();</tt>
                '''// Disable runtime services'''
+
              <tt>ServerPlatform serverPlatform = session.getServerPlatform();</tt>
                Session session event.getSession();
+
              <tt>serverPlatform.disableRuntimeServices();</tt>
                ServerPlatform serverPlatform = session.getServerPlatform();
+
          <tt>}</tt>
                serverPlatform.disableRuntimeServices();
+
      <tt>};</tt>
            }
+
      <tt>'''// Register session event listener'''</tt>
        };
+
      <tt>session.getEventManager().addListener(myEventListener);</tt>
        '''// Register session event listener'''
+
  <tt>}</tt>
        session.getEventManager().addListener(myEventListener);
+
  <tt>}</tt>
    }
+
  }
+
 
</div>
 
</div>
For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring Session Event Listeners|Configuring Session Event Listeners]]</li>
+
For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring Session Event Listeners|Configuring Session Event Listeners]].
<li> Package your EclipseLink application, including your session customizer, and re-deploy on OC4J. For more information, see [[Introduction to EclipseLink Application Development (ELUG)]].</li>
+
<li> Package your EclipseLink application, including your session customizer, and redeploy on Oracle WebLogic Server.<br>For more information, see [[Packaging%20a%20EclipseLink%20Application%20(ELUG)|Packaging an EclipseLink Application]] and [[Deploying%20a%20EclipseLink%20Application%20(ELUG)|Deploying an EclipseLink Application]].
<li> Confirm that EclipseLink JMX MBean instances for your application are not deployed.For more information, see [[#Confirming that EclipseLink JMX MBeans are Deployed|Confirming that EclipseLink JMX MBeans are Deployed]].</li>
+
<li> Confirm that EclipseLink JMX MBean instances for your application are not deployed.
 
</ol>
 
</ol>
  
  
 +
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 +
| align="left" |
 +
'''Note''': Follow the preceding procedure if you EclipseLink application does not include an Oracle WebLogic Server <tt>sessions.xml</tt> file (such as a EclipseLink JPA application).
 +
|}
  
 +
<!--
 +
====Handling Exceptions====
 +
EclipseLink logs warning messages and the stack trace for exceptions involving naming, security and session collision
 +
-->
 
====What You May Need to Know About EclipseLink JMX Support====
 
====What You May Need to Know About EclipseLink JMX Support====
You can use EclipseLink JMX support to access Oracle Dynamic Monitoring System (DMS) run-time data in EclipseLink-enabled applications, including both Java EE and Java SE applications.
+
For more information on EclipseLink and Oracle WebLogic Server JMX support, see the following:
 
+
* <i>Oracle WebLogic Server: Developing Manageable Applications with JMX</i>
For more information on EclipseLink and OC4J JMX support, see "Using MBeans in OC4J" in ''Oracle Fusion Middleware Administration and Application Deployment Guide for Oracle Containers for Java EE''.
+
* O<i>racle WebLogic Server: Developing Custom Management Utilities with JMX</i>
 
+
<!--* EclipseLink JMX MBean Tutorial for WebLogic at http://wiki.eclipse.org/EclipseLink/Examples/JMX/MBeans_WebLogic-->
For more information on JMX in general, see <tt>http://java.sun.com/docs/books/tutorial/jmx/index.html</tt>.
+
 
+
 
+
 
+
===How to Integrate with Oracle Application Server Clustering===
+
EclipseLink provides coordinated cache support for Oracle Application Server clusters for EclipseLink applications you deploy to Oracle Containers for J2EE (OC4J) when OC4J is running in a clustered mode.
+
 
+
For more information, see the following:
+
* [[#How to Integrate Clustering|How to Integrate Clustering]]
+
* [[Introduction%20to%20Cache%20(ELUG)#Oracle Application Server Cluster Coordinated Cache|Oracle Application Server Cluster Coordinated Cache]]
+
 
+
 
+
 
+
===How to Integrate with Oracle Application Server MaD===
+
We recommend that you consider EclipseLink support for Oracle Application Server Manageability and Diagnosability (MaD) to simplify application management and problem diagnosis.
+
 
+
 
+
 
+
==Integrating EclipseLink with BEA WebLogic Server==
+
To integrate a EclipseLink application with BEA WebLogic Server, you must consider the following:
+
* [[#How to Configure Classpath|How to Configure Classpath]]
+
* [[#How to Integrate JTA|How to Integrate JTA]]
+
* [[#How to Integrate the Security Manager|How to Integrate the Security Manager]]
+
 
+
In addition to configuring these BEA WebLogic Server-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
+
 
+
 
+
 
+
===How to Configure Classpath===
+
To configure EclipseLink support for BEA WebLogic Server, do the following:
+
# Add the following JAR files to the application server classpath:<br><tt>''<ECLIPSELINK_HOME>''/lib/java/api/eclipselink.jar</tt>
+
# Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
+
 
+
 
+
 
+
===How to Integrate JTA===
+
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]]).
+
 
+
For more information, see [[Using%20Advanced%20Unit%20of%20Work%20API%20(ELUG)#Integrating the Unit of Work with an External Transaction Service|Integrating the Unit of Work with an External Transaction Service]].
+
 
+
  
 +
For more information on JMX in general, see http://java.sun.com/docs/books/tutorial/jmx/index.html
  
 
===How to Integrate the Security Manager===
 
===How to Integrate the Security Manager===
If you use a security manager, specify a security policy file in the <tt>weblogic.policy</tt> file (normally located in the BEA WebLogic install directory), as follows:
+
If you use a security manager, specify a security policy file in the <tt>weblogic.policy</tt> file (normally located in the WebLogic install directory), as follows:
 
  -Djava.security.manager
 
  -Djava.security.manager
 
  -Djava.security.policy==c:\weblogic\weblogic.policy
 
  -Djava.security.policy==c:\weblogic\weblogic.policy
  
The BEA WebLogic installation procedure includes a sample security policy file. You need to edit the <tt>weblogic.policy</tt> file to grant permission for EclipseLink to use reflection.
+
The WebLogic installation procedure includes a sample security policy file. You need to edit the <tt>weblogic.policy</tt> file to grant permission for EclipseLink to use reflection.
  
 
The following example illustrates only the permissions that EclipseLink requires, but most <tt>weblogic.policy</tt> files contain more permissions than are shown in this example.
 
The following example illustrates only the permissions that EclipseLink requires, but most <tt>weblogic.policy</tt> files contain more permissions than are shown in this example.
Line 362: Line 313:
  
 
<span id="Example 7-5"></span>
 
<span id="Example 7-5"></span>
''''' A Subset of a "Grant" Section from a BEA WebLogic.policy File'''''
+
''''' A Subset of a "Grant" Section from a WebLogic.policy File'''''
 +
<source lang="java">
 
  grant {
 
  grant {
 
  '''// "enableSubstitution" required to run the WebLogic console'''
 
  '''// "enableSubstitution" required to run the WebLogic console'''
Line 372: Line 324:
 
     permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
 
     permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
 
  };
 
  };
 +
</source>
  
  
 +
==Integrating EclipseLink with Oracle Containers for J2EE (OC4J)==
 +
To integrate a EclipseLink application with OC4J, you must consider [[#How to Integrate with the OC4J JTA|integration with the OC4J JTA]].
 +
 +
In addition to configuring these OC4J-specific options, you must also consider the general application server integration issues described in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
 +
 +
 +
===How to Integrate with the OC4J JTA===
 +
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]]).
 +
 +
For more information, see [[Using%20Advanced%20Unit%20of%20Work%20API%20(ELUG)#Integrating the Unit of Work with an External Transaction Service|Integrating the Unit of Work with an External Transaction Service]].
 +
 +
===How to Configure the OC4J Application Server Classpath===
 +
To configure EclipseLink support for OC4J, add the <tt>eclipselink.jar</tt> file to the application server classpath in the global <tt>applib</tt> directory. Place the <tt>eclipselink.jar</tt> as noted by the element <tt><shared-library name="global.libraries"></tt> element in the <tt>$OC4J_HOME/config/server.xml</tt> file in the <tt>$OC4J_HOME/applib</tt> directory, as follows:
 +
 +
/oc4j/j2ee/home/applib/eclipselink.jar
  
 
==Integrating EclipseLink with IBM WebSphere Application Server==
 
==Integrating EclipseLink with IBM WebSphere Application Server==
 
To integrate a EclipseLink application with IBM WebSphere Application Server, you must consider the following:
 
To integrate a EclipseLink application with IBM WebSphere Application Server, you must consider the following:
* [[#How to Configure Classpath|How to Configure Classpath]]
+
* [[#How to Configure the WebSphere Classpath|How to Configure the WebSphere Classpath]]
 
* [[#How to Configure Class Loader Order|How to Configure Class Loader Order]]
 
* [[#How to Configure Class Loader Order|How to Configure Class Loader Order]]
* [[#How to Integrate JTA|How to Integrate JTA]]
+
* [[#How to Integrate with the WebSphere JTA|How to Integrate with the WebSphere JTA]]
  
 
In addition to configuring these IBM WebSphere application server-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
 
In addition to configuring these IBM WebSphere application server-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
Line 385: Line 353:
  
  
===How to Configure Classpath===
+
===How to Configure the WebSphere Classpath===
  
 
You configure the IBM WebSphere application server classpath differently depending on what version of this server you are using:
 
You configure the IBM WebSphere application server classpath differently depending on what version of this server you are using:
* [[#Configuring Classpath for IBM WebSphere Application Server 5.0 and Later|Configuring Classpath for IBM WebSphere Application Server 5.0 and Later]]
 
  
  
 
+
====Configuring Classpath for IBM WebSphere Application Server 6.1 and Later====
====Configuring Classpath for IBM WebSphere Application Server 5.1 and Later====
+
EclipseLink provides JTA and general integration support for IBM WebSphere application server 6.1 and later. To configure the classpath for this version, do the following:
EclipseLink provides JTA and general integration support for IBM WebSphere application server 5.0 and later. To configure the classpath for this version, do the following:
+
# Create a shared library that contains the <tt> ''<ECLIPSELINK_HOME>''\jlib\eclipselink.jar''</tt> file and associate the shared library with the application.
# Create a shared library that contains the following EclipseLink JAR files and associate the shared library with the application: <br> ''<ECLIPSELINK_HOME>''\lib\java\api\eclipselink.jar''
+
 
# Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
 
# Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
 
 
  
 
===How to Configure Class Loader Order===
 
===How to Configure Class Loader Order===
If you are deploying a EclipseLink enabled application that uses EclipseLink <tt>sessions.xml</tt> or XML project deployment, you must configure the order in which IBM WebSphere accesses class loaders:
+
If you are deploying a EclipseLink enabled application that uses EclipseLink <tt>sessions.xml</tt> or XML project deployment, you must use the WebSphere Application Server Administrative Console to set '''Class loader order''' to '''Class loaded with application class loader first'''.
* When using IBM WebSphere application server 5.1, use the default <tt>PARENT_FIRST</tt> classloader setting.
+
* When using IBM WebSphere application server 6.1, use the WebSphere Application Server Administrative Console to set '''Class loader order''' to '''Class loaded with application class loader first'''.
+
  
  
  
===How to Integrate JTA===
+
===How to Integrate with the WebSphere JTA===
 
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]]).
 
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]]).
  
Line 415: Line 377:
 
===How to Configure Clustering on IBM WebSphere Application Server===
 
===How to Configure Clustering on IBM WebSphere Application Server===
 
For information on integrating a EclipseLink application with an application server cluster, see [[#How to Integrate Clustering|How to Integrate Clustering]].
 
For information on integrating a EclipseLink application with an application server cluster, see [[#How to Integrate Clustering|How to Integrate Clustering]].
 +
  
  
Line 420: Line 383:
 
==Integrating EclipseLink with Sun Application Server==
 
==Integrating EclipseLink with Sun Application Server==
 
To integrate a EclipseLink application with Sun Application Server (SunAS), you must consider the following:
 
To integrate a EclipseLink application with Sun Application Server (SunAS), you must consider the following:
* [[#How to Configure Classpath|How to Configure Classpath]]
+
* [[#How to Configure the Sun Application Server Classpath|How to Configure the Sun Application Server Classpath]]
* [[#How to Integrate JTA|How to Integrate JTA]]
+
* [[#How to Integrate with the Sun Application Server JTA|How to Integrate with the Sun Application Server JTA]]
  
 
In addition to configuring these SunAS-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
 
In addition to configuring these SunAS-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
Line 427: Line 390:
  
  
===How to Configure Classpath===
+
===How to Configure the Sun Application Server Classpath===
 
To configure EclipseLink support for SunAS, do the following:
 
To configure EclipseLink support for SunAS, do the following:
# Add the following JAR files to the application server classpath: <br> <tt>''<ECLIPSELINK_HOME>''\lib\java\api\eclipselink.jar</tt>
+
# Add the <tt>''<ECLIPSELINK_HOME>''\jlib\eclipselink.jar</tt> file to the application server classpath.
 
# Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
 
# Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
  
===How to Integrate JTA===
+
===How to Integrate with the Sun Application Server JTA===
 
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)|Configuring the Server Platform]]).
 
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)|Configuring the Server Platform]]).
  
 
For more information, see [[Using%20Advanced%20Unit%20of%20Work%20API%20(ELUG)#Integrating the Unit of Work with an External Transaction Service|Integrating the Unit of Work with an External Transaction Service]].
 
For more information, see [[Using%20Advanced%20Unit%20of%20Work%20API%20(ELUG)#Integrating the Unit of Work with an External Transaction Service|Integrating the Unit of Work with an External Transaction Service]].
 +
 +
 +
  
 
==Integrating EclipseLink with JBoss Application Server==
 
==Integrating EclipseLink with JBoss Application Server==
 +
 +
These instructions apply to JBoss AS versions prior to AS7. AS7 changes the setup quite dramatically; the best available documentation is currently here: https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7</b>
 +
 
To integrate a EclipseLink application with JBoss Application Server, you must consider the following:
 
To integrate a EclipseLink application with JBoss Application Server, you must consider the following:
* [[#How to Configure Classpath|How to Configure Classpath|How to Configure Classpath]]
+
* [[#How to Configure the JBoss Classpath|How to Configure the JBoss Classpath]]
* [[#How to Integrate JTA|How to Integrate JTA]]
+
* [[#How to Integrate with the JBoss JTA|How to Integrate with the JBoss JTA]]
  
 
In addition to configuring these JBoss-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
 
In addition to configuring these JBoss-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
Line 446: Line 415:
  
  
===How to Configure Classpath===
+
===How to Configure the JBoss Classpath===
 
To configure EclipseLink support for JBoss, do the following:
 
To configure EclipseLink support for JBoss, do the following:
# Add the following JAR files to the application server classpath:<br><tt>''<ECLIPSELINK_HOME>''\lib\java\api\eclipselink.jar</tt>
+
# Add the <tt>''<ECLIPSELINK_HOME>''\jlib\eclipselink.jar</tt> file to the application server classpath.
 
# Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
 
# Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
  
 
+
===How to Integrate with the JBoss JTA===
 
+
===How to Integrate JTA===
+
 
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]]).
 
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]]).
  
Line 459: Line 426:
  
  
 +
 +
===How to Configure JPA Application Deployment to JBoss 4.2 Application Server===
 +
For JPA applications, to enable the container to manage entities, statically weave the entities and reference JBoss as the target server in the <tt>persistence.xml</tt> file.
 +
 +
Perform the following deployment changes:
 +
<ol>
 +
<li> If weaving is required, statically weave the entities before EAR packaging. Use  either the command-line weaver or the weaving Ant task (see [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#How to Configure Static Weaving for JPA Entities|How to Configure Static Weaving for JPA Entities]]).</li>
 +
<li> Ensure that the <tt>eclipselink.target-server</tt> property (see [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#Using EclipseLink JPA Extensions for Session, Target Database and Target Application Server|Using EclipseLink JPA Extensions for Session, Target Database and Target Application Server]]) is set in the <tt>persistence.xml</tt> file of all persistence units deployed to the JBoss container:
 +
<div class="pre">
 +
<tt><property name="eclipselink.target-server" value="JBoss"/></tt>
 +
</div>
 +
Otherwise, even though the container-managed entities are predeployed, they will not be managed at run time.</li>
 +
</ol>
 +
For more information and examples, see the following:
 +
* http://wiki.eclipse.org/EclipseLink/Examples/JPA/Migration/JBoss
 +
* [[Packaging%20and%20Deploying%20EclipseLink%20JPA%20Applications%20(ELUG)#How to Deploy an Application to Generic Java EE 5 Application Servers|How to Deploy an Application to Generic Java EE 5 Application Servers]]
 +
 +
==Integrating EclipseLink with SAP NetWeaver Application Server==
 +
To integrate a EclipseLink application with SAP NetWeaver Application Server, you must consider the following:
 +
* [[#How to Configure the NetWeaver Classpath|How to Configure the NetWeaver Classpath]]
 +
* [[#How to Integrate with the NetWeaver JTA|How to Integrate with the NetWeaver JTA]]
 +
 +
In addition to configuring these NetWeaver-specific options, you must also consider the general application server integration issues in [[#Integrating EclipseLink with an Application Server|Integrating EclipseLink with an Application Server]].
 +
 +
 +
 +
===How to Configure the NetWeaver Classpath===
 +
To configure EclipseLink support for NetWeaver, do the following:
 +
# Create and deploy a standard library (i.e. an SDA file) that contains the  <tt> ''<ECLIPSELINK_HOME>''\jlib\eclipselink.jar</tt> file and associate the library with the application.
 +
# Ensure that your EclipseLink application defines an XML parser platform (see [[#How to Configure the XML Parser Platform|How to Configure the XML Parser Platform]]).
 +
 +
===How to Integrate with the NetWeaver JTA===
 +
For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session. See [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]] for general information on configuring the server platform and [[EclipseLink/Development/ServerPlatform/NetweaverPlatform]] for a description of the NetWeaver server platform.
 +
 +
For more information, see [[Using%20Advanced%20Unit%20of%20Work%20API%20(ELUG)#Integrating the Unit of Work with an External Transaction Service|Integrating the Unit of Work with an External Transaction Service]].
  
 
==Defining Security Permissions==
 
==Defining Security Permissions==
Line 542: Line 544:
  
 
* The <tt>eclipselink.jar</tt> file. For example:  
 
* The <tt>eclipselink.jar</tt> file. For example:  
  grant codeBase "file:<ECLIPSELINK_HOME>/lib/java/api/eclipselink.jar" {
+
  grant codeBase "file:<ECLIPSELINK_HOME>/jlib/eclipselink.jar" {
 
     permission java.security.AllPermission;
 
     permission java.security.AllPermission;
 
  };
 
  };
Line 559: Line 561:
  
 
You may also have to grant additional permissions depending on the EclipseLink features your application uses. For more information, see [[#How_to_Define Permissions_Required_by_EclipseLink_Features|How to Define Permissions Required by EclipseLink Features]].
 
You may also have to grant additional permissions depending on the EclipseLink features your application uses. For more information, see [[#How_to_Define Permissions_Required_by_EclipseLink_Features|How to Define Permissions Required by EclipseLink Features]].
 +
  
  
 
===How to Disable doPrivileged Operation===
 
===How to Disable doPrivileged Operation===
To disable <tt>doPrivileged</tt> operation when you run a EclipseLink-enabled application in a JVM configured with a nondefault <tt>java.lang.SecurityManager</tt>, set system property <tt>oracle.j2ee.toplink.security.usedoprivileged</tt> to <tt>false</tt>. If you are using OC4J, set system property <tt>oracle.j2ee.security.usedoprivileged</tt> to <tt>false</tt>.
+
To disable <tt>doPrivileged</tt> operation when you run a EclipseLink-enabled application in a JVM configured with a nondefault <tt>java.lang.SecurityManager</tt>, set system property <tt>oracle.j2ee.security.usedoprivileged</tt> to <tt>false</tt>. If you are using OC4J, set system property <tt>oracle.j2ee.security.usedoprivileged</tt> to <tt>false</tt>.
  
 
To enable <tt>doPrivileged</tt> operation, set these system properties to <tt>true</tt>.
 
To enable <tt>doPrivileged</tt> operation, set these system properties to <tt>true</tt>.

Latest revision as of 11:21, 18 July 2012

Elug draft icon.png For the latest EclipseLink documentation, please see http://www.eclipse.org/eclipselink/documentation/


Contents

Related Topics

This section describes how to configure EclipseLink for use with Java EE containers and application servers.

For more information, see the following:


Introduction to the Application Server Support

EclipseLink can be used with any Java EE application server that meets the software requirements through the EclipseLink API.

There is EclipseLink-specific integration support for the following servers:



Integrating EclipseLink with an Application Server

This section describes concepts unique to EclipseLink application server integration, including the following:


What Are the Software Requirements

To run a EclipseLink application within a Java EE container, your system must meet the following software requirements:

  • An application server or Java EE container
  • XML parser (see How to Configure the XML Parser Platform);
  • A JDBC driver configured to connect with your local database system (for more information, see your database administrator);
  • A Java development environment, such as the following:
    • Eclipse IDE;
    • Oracle JDeveloper;
    • IBM WebSphere Studio Application Developer (WSAD);
    • Sun Java Development Kit (JDK) 1.5 or later;
  • Any other Java environment that is compatible with the Sun JDK 1.5 or later;
  • A command-line JVM executable (such as java.exe or jre.exe).


How to Configure the XML Parser Platform

The EclipseLink run-time environment uses an XML parser to do the following:

Application servers use an XML parser to read deployment files, such as ejb-jar.xml and <Java EE container>-ejb-jar.xml files (see Creating EclipseLink Files for Deployment).

To avoid XML parser conflicts, you must configure your EclipseLink application to use the same XML parser as that used by the application server on which you deploy your application.

Internally, EclipseLink accesses its XML parser using an instance of org.eclipse.persistence.platform.xml.XMLPlatform class.

You can configure EclipseLink to use any XML parser for which an XMLPlatform class exists (see Configuring XML Parser Platform).

You can also create your own XMLPlatform to provide access to an XML parser not currently supported by EclipseLink (see Creating an XML Parser Platform).


Configuring XML Parser Platform

EclipseLink provides the XMLPlatform instances shown in the following table.

Supported XML Platforms

XMLPlatform... Provides Access to... Use with...

org.eclipse.persistence.platform.xml.xdk.XDKPlatform

XDKParser: this class provides access to the Oracle XML Developer's Kit (XDK) XML parser (see http://www.oracle.com/technology/tech/xml/xdkhome.html).

Integrating EclipseLink with Oracle Containers for J2EE (OC4J)

org.eclipse.persistence.platform.xml.jaxp.JAXPPlatform1

JAXPParser: this class provides access to the Java SDK XML parser in the javax.xml.parsers package (see http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPIntro2.html).

See the following:


1 Default.

Note: To use an XML parser not listed in this table, create your own XMLPlatform (see Creating an XML Parser Platform).


To configure your EclipseLink application to use a particular instance of the XMLPlatform class, set system property eclipse.persistence.xml.platform to the fully qualified name of your XMLPlatform class, as the following example shows.

Configuring XML Platform

eclipse.persistence.xml.platform=org.eclipse.persistence.platform.xml.jaxp.JAXPPlatform


Creating an XML Parser Platform

Using the org.eclipse.persistence.internal.xml classes you can create your own instance of the org.eclipse.persistence.platform.xml.XMLPlatform class to specify an XML parser not listed in the Supported XML Platforms table.

After creating your XMLPlatform, configure EclipseLink to use it (see Configuring XML Parser Platform).


XML Parser Limitations

Crimson (http://xml.apache.org/crimson/) is the XML parser supplied in the Java Platform, Standard Edition (Java SE) and in some JAXP reference implementations.

If you use Crimson with the JAXP API to parse XML files whose system identifier is not a fully qualified URL, then XML parsing will fail with a not valid URL exception.

Other XML parsers defer validation of the system identifier URL until it is specifically referenced.

If you are experiencing this problem, consider one of the following alternatives:

  • Ensure that your XML files use a fully qualified system identifier URL.
  • Use another XML parser (such as the OracleAS XML Parser for Java v2).


How to Set Security Permissions

By default, when you run a EclipseLink-enabled application in a JVM configured with a nondefault java.lang.SecurityManager, the EclipseLink run-time environment executes certain internal functions by executing a PrivilegedAction with java.security.AccessController method doPrivileged. This ensures that you do not need to grant many permissions to EclipseLink for it to perform its most common operations. You need only grant certain permissions depending on the types of optional EclipseLink features you use.

For more information, see Defining Security Permissions.

If you run a EclipseLink-enabled application in a JVM without a nondefault SecurityManager, you do not need to set any permissions.


How to Integrate Clustering

Most application servers include a clustering service that you can use with your EclipseLink application.

To use EclipseLink with an application server cluster, use this general procedure:

  1. Install the eclipselink.jar file (and include it in the classpath) on each application server in the cluster to which you deploy EclipseLink applications.
  2. Configure EclipseLink cache consistency options appropriate for your application.
    For more information, see Introduction to Cache.
  3. Configure clustering on each application server.
    For more information, see your application server documentation.



Integrating EclipseLink with Oracle WebLogic Server

To integrate an EclipseLink application with Oracle WebLogic Server, you must consider the following:

In addition to configuring these Oracle WebLogic Server-specific options, you must also consider the general application server integration issues in Integrating EclipseLink with an Application Server.


How to Configure the WebLogic Classpath

EclipseLink works out of the box in Oracle WebLogic Server 10.3. The EclipseLink library resides in the following location on the server:

$BEA_HOME/modules/org.eclipse.persistence_*.jar

Ensure that your EclipseLink application defines an XML parser platform (see How to Configure the XML Parser Platform).

How to Integrate with the WebLogic JTA

For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see Configuring the Server Platform).

For more information, see Integrating the Unit of Work with an External Transaction Service.

How to Integrate JMX

By default, when you deploy an EclipseLink application to Oracle WebLogic Server, the EclipseLink runtime deploys the following Java Management Extensions (JMX) MBeans to the Oracle WebLogic Server JMX service for each EclipseLink session:

  • org.eclipse.persistence.services.DevelopmentServices - This class is meant to provide facilities for managing an EclipseLink session internal to EclipseLink over JMX.
  • org.eclipse.persistence.services.RuntimeServices - This class is meant to provide facilities for managing an EclipseLink session external to EclipseLink over JMX.

Use the API that this JMX MBean exposes to access and configure your EclipseLink sessions at run time using JMX code that you write, or to integrate your EclipseLink application with a third-party JMX management application, such as JConsole.

Setting Up the Environment for EclipseLink JMX MBeans

Perform the following steps:

  1. Set breakpoints: the eclipselink.jar deployed in the $WEBLOGIC_HOME/modules/org.eclipse.persistence_n.n.n.jar needs a source attachment. You set a breakpoint on the undeploy method of the org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl pointing to the source JAR file or your workspace projects, and then redeploy. This will result in any breakpoints set in the predeploy method or prior to the first login to be hit.
  2. Enable remote access on the Oracle WebLogic Server JVM by adding the following JVM option to your WebLogic startup script:
    C:\opt\wls103\user_projects\domains\base_domain\bin\startWebLogic.cmd
    set JAVA_OPTIONS=%JAVA_OPTIONS% -Dcom.sun.management.jmxremote
  3. Enable MBean registration (deployment) by adding one or both of the two MBean system properties, as follows:
    rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.dev.mbean=true
    rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.run.mbean=true
    By default, EclipseLink does not register MBeans for Oracle WebLogic Server. If you enable the registration, it will occur as a post step during the first login to the session (see Configuring a Session Login).
    If both eclipselink.register.dev.mbean and eclipselink.register.run.mbean properties are missing, MBean registration will not proceed for that bean.
  4. Configure Oracle WebLogic Server domain security.
    For more information, see EclipseLink JMX MBean Support in Oracle WebLogic Server tutorial.

Accessing EclipseLink JMX MBeans Using a Third-Party JMX Management Application

After you deploy your EclipseLink application, you can use any JMX-compliant management application to access and use the full public API that EclipseLink MBeans provide.

To access EclipseLink JMX MBeans using a third-party JMX management application:

  1. Package and deploy your EclipseLink application to Oracle WebLogic Server.
    For more information, see Deploying an EclipseLink Application.
  2. Optionally, examine Oracle WebLogic Server logs and look for the appropriate log messages. Note that for a JPA application, EclipseLink session instantiation and login occurs at EntityManager instantiation time.
  3. Launch your third-party JMX management application.
    For example, launch JConsole (JDK_HOME\bin\jconsole.exe) using the command prompt, and then select the running weblogic.Server local process, as the following figure shows.

    Jconsole attach to weblogic server jvm.jpg

  1. Optionally, launch JRockit Mission Control JMC.exe, attach to the JVM process and navigate to the MBeans tab - you will see the following screen showing the EclipsLink MBeans for your session.

Jrockit jconsole mbeans via non jndi generic spec lookup.JPG

Disabling EclipseLink JMX Support

There are a number of ways to disable EclipseLink JMX support.

To disable deployment of MBeans to Oracle WebLogic Server for your EclipseLink application using system properties, remove, disable, or do not add in the first place eclipselink.register.dev.mbean and eclipselink.register.run.mbean MBean system properties. The following example shows how to disable these properties:
rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.dev.mbean=false
rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.run.mbean=false.


To disable deployment of MBeans to Oracle WebLogic Server for your EclipseLink application using deployment XML, use an EclipseLink sessions.xml file (assuming your application has one):

  1. Undeploy your EclipseLink application on Oracle WebLogic Server.
  2. Edit your EclipseLink application’s Oracle WebLogic Server platform to disable run-time services.
    For more information, see Configuring the Server Platform.
  3. Package your EclipseLink application and redeploy on Oracle WebLogic Server.
    For more information, see Deploying an EclipseLink Application.
  4. Confirm that EclipseLink JMX MBean instances for your application no longer exist.

If your application does not include an EclipseLink sessions.xml file, you can use a preLogin event handler to disable this feature (see the following section).


To disable deployment of MBeans to Oracle WebLogic Server for your EclipseLink application using the EclipseLink session preLogin event handler:

  1. Undeploy your EclipseLink application on Oracle WebLogic Server.
  2. Create an EclipseLink session customizer.
    For more information, see Configuring a Session Customizer Class.
  3. In your session customizer, create a session event listener for the preLogin session event and register the listener with the session event manager, as the following example shows.
    import oracle.eclipselink.tools.sessionconfiguration.SessionCustomizer;
    import oracle.eclipselink.sessions.Session;
    import oracle.eclipselink.sessions.SessionEvent;
    import oracle.eclipselink.sessions.SessionEventAdapter;
    import oracle.eclipselink.platform.server.ServerPlatform;
    public class EmployeeSessionCustomizer implements SessionCustomizer {
      
      public void customize(Sesssion session) {
          SessionEventAdapter myEventListener = new SessionEventAdapter() {
              // Listen for preLogin event
              public void preLogin(SessionEvent event) {
                  // Disable runtime services
                  Session session event.getSession();
                  ServerPlatform serverPlatform = session.getServerPlatform();
                  serverPlatform.disableRuntimeServices();
              }
          };
          // Register session event listener
          session.getEventManager().addListener(myEventListener);
      }
    }
    

    For more information, see Configuring Session Event Listeners.

  4. Package your EclipseLink application, including your session customizer, and redeploy on Oracle WebLogic Server.
    For more information, see Packaging an EclipseLink Application and Deploying an EclipseLink Application.
  5. Confirm that EclipseLink JMX MBean instances for your application are not deployed.


Note: Follow the preceding procedure if you EclipseLink application does not include an Oracle WebLogic Server sessions.xml file (such as a EclipseLink JPA application).

What You May Need to Know About EclipseLink JMX Support

For more information on EclipseLink and Oracle WebLogic Server JMX support, see the following:

  • Oracle WebLogic Server: Developing Manageable Applications with JMX
  • Oracle WebLogic Server: Developing Custom Management Utilities with JMX

For more information on JMX in general, see http://java.sun.com/docs/books/tutorial/jmx/index.html

How to Integrate the Security Manager

If you use a security manager, specify a security policy file in the weblogic.policy file (normally located in the WebLogic install directory), as follows:

-Djava.security.manager
-Djava.security.policy==c:\weblogic\weblogic.policy

The WebLogic installation procedure includes a sample security policy file. You need to edit the weblogic.policy file to grant permission for EclipseLink to use reflection.

The following example illustrates only the permissions that EclipseLink requires, but most weblogic.policy files contain more permissions than are shown in this example.


A Subset of a "Grant" Section from a WebLogic.policy File

 grant {
 '''// "enableSubstitution" required to run the WebLogic console'''
 permission java.io.SerializablePermission "enableSubstitution";
 '''// "modifyThreadGroup" required to run the WebLogic Server'''
 permission java.lang.RuntimePermission "modifyThreadGroup";
 '''// grant permission for EclipseLink to use reflection'''
 
     permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
 };


Integrating EclipseLink with Oracle Containers for J2EE (OC4J)

To integrate a EclipseLink application with OC4J, you must consider integration with the OC4J JTA.

In addition to configuring these OC4J-specific options, you must also consider the general application server integration issues described in Integrating EclipseLink with an Application Server.


How to Integrate with the OC4J JTA

For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see Configuring the Server Platform).

For more information, see Integrating the Unit of Work with an External Transaction Service.

How to Configure the OC4J Application Server Classpath

To configure EclipseLink support for OC4J, add the eclipselink.jar file to the application server classpath in the global applib directory. Place the eclipselink.jar as noted by the element <shared-library name="global.libraries"> element in the $OC4J_HOME/config/server.xml file in the $OC4J_HOME/applib directory, as follows:

/oc4j/j2ee/home/applib/eclipselink.jar

Integrating EclipseLink with IBM WebSphere Application Server

To integrate a EclipseLink application with IBM WebSphere Application Server, you must consider the following:

In addition to configuring these IBM WebSphere application server-specific options, you must also consider the general application server integration issues in Integrating EclipseLink with an Application Server.


How to Configure the WebSphere Classpath

You configure the IBM WebSphere application server classpath differently depending on what version of this server you are using:


Configuring Classpath for IBM WebSphere Application Server 6.1 and Later

EclipseLink provides JTA and general integration support for IBM WebSphere application server 6.1 and later. To configure the classpath for this version, do the following:

  1. Create a shared library that contains the <ECLIPSELINK_HOME>\jlib\eclipselink.jar file and associate the shared library with the application.
  2. Ensure that your EclipseLink application defines an XML parser platform (see How to Configure the XML Parser Platform).

How to Configure Class Loader Order

If you are deploying a EclipseLink enabled application that uses EclipseLink sessions.xml or XML project deployment, you must use the WebSphere Application Server Administrative Console to set Class loader order to Class loaded with application class loader first.


How to Integrate with the WebSphere JTA

For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see Configuring the Server Platform).

For more information, see Integrating the Unit of Work with an External Transaction Service.


How to Configure Clustering on IBM WebSphere Application Server

For information on integrating a EclipseLink application with an application server cluster, see How to Integrate Clustering.



Integrating EclipseLink with Sun Application Server

To integrate a EclipseLink application with Sun Application Server (SunAS), you must consider the following:

In addition to configuring these SunAS-specific options, you must also consider the general application server integration issues in Integrating EclipseLink with an Application Server.


How to Configure the Sun Application Server Classpath

To configure EclipseLink support for SunAS, do the following:

  1. Add the <ECLIPSELINK_HOME>\jlib\eclipselink.jar file to the application server classpath.
  2. Ensure that your EclipseLink application defines an XML parser platform (see How to Configure the XML Parser Platform).

How to Integrate with the Sun Application Server JTA

For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see Configuring the Server Platform).

For more information, see Integrating the Unit of Work with an External Transaction Service.



Integrating EclipseLink with JBoss Application Server

These instructions apply to JBoss AS versions prior to AS7. AS7 changes the setup quite dramatically; the best available documentation is currently here: https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7</b>

To integrate a EclipseLink application with JBoss Application Server, you must consider the following:

In addition to configuring these JBoss-specific options, you must also consider the general application server integration issues in Integrating EclipseLink with an Application Server.


How to Configure the JBoss Classpath

To configure EclipseLink support for JBoss, do the following:

  1. Add the <ECLIPSELINK_HOME>\jlib\eclipselink.jar file to the application server classpath.
  2. Ensure that your EclipseLink application defines an XML parser platform (see How to Configure the XML Parser Platform).

How to Integrate with the JBoss JTA

For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session (see Configuring the Server Platform).

For more information, see Integrating the Unit of Work with an External Transaction Service.


How to Configure JPA Application Deployment to JBoss 4.2 Application Server

For JPA applications, to enable the container to manage entities, statically weave the entities and reference JBoss as the target server in the persistence.xml file.

Perform the following deployment changes:

  1. If weaving is required, statically weave the entities before EAR packaging. Use either the command-line weaver or the weaving Ant task (see How to Configure Static Weaving for JPA Entities).
  2. Ensure that the eclipselink.target-server property (see Using EclipseLink JPA Extensions for Session, Target Database and Target Application Server) is set in the persistence.xml file of all persistence units deployed to the JBoss container:
    <property name="eclipselink.target-server" value="JBoss"/>
    
    Otherwise, even though the container-managed entities are predeployed, they will not be managed at run time.

For more information and examples, see the following:

Integrating EclipseLink with SAP NetWeaver Application Server

To integrate a EclipseLink application with SAP NetWeaver Application Server, you must consider the following:

In addition to configuring these NetWeaver-specific options, you must also consider the general application server integration issues in Integrating EclipseLink with an Application Server.


How to Configure the NetWeaver Classpath

To configure EclipseLink support for NetWeaver, do the following:

  1. Create and deploy a standard library (i.e. an SDA file) that contains the <ECLIPSELINK_HOME>\jlib\eclipselink.jar file and associate the library with the application.
  2. Ensure that your EclipseLink application defines an XML parser platform (see How to Configure the XML Parser Platform).

How to Integrate with the NetWeaver JTA

For applications that require JTA integration, specify the external transaction controller when you configure the server platform in your session. See Configuring the Server Platform for general information on configuring the server platform and EclipseLink/Development/ServerPlatform/NetweaverPlatform for a description of the NetWeaver server platform.

For more information, see Integrating the Unit of Work with an External Transaction Service.

Defining Security Permissions

By default, when you run a EclipseLink-enabled application in a JVM configured with a nondefault java.lang.SecurityManager, the EclipseLink run time executes certain internal functions by executing a PrivilegedAction with java.security.AccessController method doPrivileged. This ensures that you do not need to grant many permissions to EclipseLink for it to perform its most common operations. You need only grant certain permissions depending on the types of optional EclipseLink features you use (see How to Define Permissions Required by EclipseLink Features).

While using doPrivileged method provides enhanced security, it will severely impact overall performance. Alternatively, you can configure EclipseLink to disable the use of doPrivileged method even when a nondefault SecurityManager is present (see How to Disable doPrivileged Operation). In this case, you must grant EclipseLink all required permissions (see How to Define Permissions Required by EclipseLink Features and How to Define Permissions Required when doPrivileged Is Disabled).


Note: While enabling the use of doPriviledged method enhances EclipseLink application security, it does not guarantee that secure code cannot be called by application code in ways that the system did not intend. You must consider the use of doPriviledged method within the context of your overall application security strategy. For more information, see http://java.sun.com/security/index.jsp.


If you run a EclipseLink-enabled application in a JVM without a nondefault SecurityManager, you do not need to grant any permissions.


How to Define Permissions Required by EclipseLink Features

When you run a EclipseLink-enabled application in a JVM configured with a nondefault java.lang.SecurityManager and doPrivileged operation is enabled, you may need to grant additional permissions if your application requires any of the following:


Defining System Properties

By default, a EclipseLink-enabled application requires access to the system properties granted in the default <JAVA_HOME>/lib/security/java.policy file. If your application requires access to other platform-specific, environment, or custom properties, then grant further PropertyPermission permissions, as the following example shows.

Permissions for System Properties

permission java.util.PropertyPermission "my.property", "read";


Loading project.xml or sessions.xml Files

Most EclipseLink-enabled applications read in project.xml and sessions.xml files directly. Grant permissions to the specific files or file locations, as the following example shows. This example assumes that both project.xml and sessions.xml files are located in the same directory (given by application-specific system property deployment.xml.home). Alternatively, you can specify a separate FilePermission for each file.


Permissions for Loading Deployment XML Files

permission java.io.FilePermission "${deployment.xml.home}/*.xml", "read";

For information on FilePermission settings for Java EE applications, see Granting Permissions for Java EE Application Deployment.


Defining Cache Coordination

If your application uses cache coordination (see Cache Coordination), then grant accept, connect, listen, and resolve permissions to the specific sockets used by your coordinated cache, as the following example shows. This example assumes that the coordinated cache multicast port (see Configuring a Multicast Port) is 1024.

Permissions for Cache Coordination

permission java.net.SocketPermission "localhost:1024-", "accept, connect, listen, resolve";


Accessing a Data Source by Port

If your EclipseLink-enabled application accesses a data source using a socket, then grant connect and resolve permissions for that socket, as the following example shows. This example assumes that the host name (or IP address) of the remote host that provides the data source (such as a relational database server host) is given by application-specific system property remote.data.source.host and that this host accepts data source connections on port 1025.

Permissions for non-Java EE Data Source Connections

permission java.net.SocketPermission "${remote.data.source.host}:1025-", "connect, resolve";

For Java EE applications, data source socket permissions are usually handled by the application server.


Logging with java.util.logging

If you configure your EclipseLink-enabled application to use java.util.logging package (see Configuring Logging), then grant your application control permissions, as this example shows.


Permissions for java.util.logging

permission java.util.logging.LoggingPermission "control"


Granting Permissions for Java EE Application Deployment

If you are deploying a EclipseLink-enabled Java EE application, you must grant permissions for the following:

  • The eclipselink.jar file. For example:
grant codeBase "file:<ECLIPSELINK_HOME>/jlib/eclipselink.jar" {
    permission java.security.AllPermission;
};

If you are using an XML platform, you must also grant the following permissions:

  • The eclipse.persistence.xml.platform system property. For Example:
permission java.util.PropertyPermission "eclipse.persistence.xml.platform", "read"


How to Define Permissions Required when doPrivileged Is Disabled

If you disable doPrivileged operation when you run a EclipseLink-enabled application in a JVM configured with a nondefault java.lang.SecurityManager, you must grant the following permissions:

  • java.lang.reflect.RelectPermission "suppressAccessChecks"
  • java.lang.RuntimePermission "accessDeclaredMembers"
  • java.lang.RuntimePermission "getClassLoader"

You may also have to grant additional permissions depending on the EclipseLink features your application uses. For more information, see How to Define Permissions Required by EclipseLink Features.


How to Disable doPrivileged Operation

To disable doPrivileged operation when you run a EclipseLink-enabled application in a JVM configured with a nondefault java.lang.SecurityManager, set system property oracle.j2ee.security.usedoprivileged to false. If you are using OC4J, set system property oracle.j2ee.security.usedoprivileged to false.

To enable doPrivileged operation, set these system properties to true.



Copyright Statement

Back to the top