Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/JPA/WebSphere Web Tutorial"

m (EclipseLink JPA Deployed on IBM WebSphere 6.1 using Eclipse WTP)
m (References)
 
(12 intermediate revisions by one other user not shown)
Line 1: Line 1:
=EclipseLink JPA Deployed on IBM WebSphere 6.1 using Eclipse WTP=
+
= EclipseLink JPA Deployed on IBM WebSphere 7 using Eclipse WTP =
  
<font color="red">Note: This tutorial' is under construction for the next week as of 20080918.</font>
+
<font color="#ff0000">Note: This tutorial' was under construction for the next week as of 2010415 under bug# '''[http://bugs.eclipse.org/309201 309201]'''.</font> and '''[http://bugs.eclipse.org/309975 309975]'''
  
 +
If you want to get a small web application running quickly on WebSphere 7.0 you can use Eclipse to create the EAR and [[EclipseLink/Examples/JPA/WebSphere7 Web Tutorial#Remote_Debugging_EclipseLink_in_WebSphere_7.0_from_Eclipse_3.4|attach to a running WebSphere instance in debug mode on port 7781]].
  
If you want to get a small web application running quickly on WebSphere 6.1 - the services provided by the '''Web Tools Project''' pluggin in the '''Eclipse IDE''' can take care of the deployment details and set the server into debug mode for you.
+
This basic example details how to use Eclipse to run/debug a minimum J2EE web application servlet using EclipseLink JPA as the persistence provider. The goal of this example is to detail the minimum steps required to run EclipseLink inside the [http://www.ibm.com/developerworks/downloads/ws/was/?S_TACT=105AGX28&S_CMP=DLMAIN&S_CMP=rnav IBM WebSphere Application Server 7.0] server using the Eclipse IDE. At this point no presentation/controller layer such as JSF, Spring or Struts will be used beyond a basic HttpServlet so we can concentrate on the the integration layer JPA setup.  
  
This basic example details how to use Eclipse to run/debug a minimum J2EE web application servlet using EclipseLink JPA as the persistence provider.  The goal of this example is to detail the minimum steps required to run EclipseLink inside the [http://www.ibm.com/developerworks/downloads/ws/was/?S_TACT=105AGX28&S_CMP=DLMAIN&S_CMP=rnav IBM WebSphere Application Server 6.1] server using the Eclipse IDE.  At this point no presentation/controller layer such as JSF, Spring or Struts will be used beyond a basic HttpServlet so we can concentrate on the the integration layer JPA setup.
+
The [http://wiki.eclipse.org/Dali DALI] project can be used to generate Entities from a schema with sequences already populated.  
  
The [http://wiki.eclipse.org/Dali DALI] project was used to generate Entities from a schema with sequences already populated.
+
Tables can be populated by persisting an instance of the mode in an SE JPA persistence unit with DDL generation turned on.  
  
==Development Environment==
+
'''The recommended configuration for running EclipseLink as the JPA provider on WebSphere 7 are the following [http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebSphere7_Web_Tutorial#Container_Managed_and_Application_Managed_Scenarios container managed scenarios] below.'''
'''Software:''' [http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/ganymede/R/eclipse-jee-ganymede-win32.zip Eclipse IDE for Java EE 3.4 Ganymede] (June 2008 +) with all 5 packages (DTP 1.6, EMF 2.4, GEF 3.4, WTP 3.0, XSD 2.4), [http://db.apache.org/derby Derby Database 10.4], Java JDK 1.6.0_04, [http://www.ibm.com/developerworks/downloads/ws/was/?S_TACT=105AGX28&S_CMP=DLMAIN&S_CMP=rnav IBM WebSphere 6.1.0.0 with EJB3/JPA1 update]
+
  
This example will run fine with any Database that EclipseLink supports.
+
== QuickStart Steps ==
  
==Prerequisites==
+
*More details are below, but here are the main steps for advanced users via a specific config run of an EclipseLink JPA app on WebSphere 7.0.0.0 (no security).
===<font color="green">Install Eclipse EE</font>===
+
*Start the derby database: '''C:\opt\derby10530\bin\startNetworkServer.bat'''
*I installed a clean version of Eclipse Ganymede (June 2008) with all of WTP 3.0
+
*Start WebSphere: '''C:\opt\was7b\AppServer\profiles\AppSrv01\bin\startServer.bat server1'''
 +
*Start the admin console: '''http://xps435:9060/ibm/console'''
 +
*Deploy EAR on the console:
 +
*Run demo servlet: '''http://127.0.0.1:9080/enterprise'''
  
===<font color="green">Install a Database</font>===
+
== Development Environment ==
*In this example I am using the embedded [http://db.apache.org/derby Derby 10.4], the table schemas have already been created manually and all entity java classes may be generated using the Eclipse [http://wiki.eclipse.org/Dali DALI] tool.
+
*There is also an express version of [http://www-01.ibm.com/software/data/db2/express/ IBM DB2 Express C 9.5] available
+
===<font color="green">Install WebSphere 6.1</font>===
+
I installed the commercial 6.1.0.0 version with the EJB 3.0 fixpack and updates.
+
*download.updii.61017.windows.ia32.zip
+
*6.1.0-WS-WASSDK-WinX32-FP0000017.pak
+
*6.1.0-WS-WAS-WinX32-FP0000017.pak
+
*6.1.0-WS-WASEJB3-WinX32-FP0000017.pak
+
*I augumented the original server profile
+
  
 +
=== Software ===
  
===Install WebSphere Eclipse 3.4 Server Plugin===
+
*'''http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR2/eclipse-jee-galileo-SR2-win32.zip Eclipse IDE for Java EE 3.5 Galileo SR 2] (April 2010 +) IBM J9 JRE 1.6.0 build 2.4 20080816_22093.'''
The WebSphere 6.1 Eclipse WTP server plugin is not shipped by default with Eclipse (WebSphere 6.0 for JEE 1.4 is).
+
*'''Note: The WebSphere 6.1 plugin is currently not available - see the following [http://bugs.eclipse.org/160220 Eclipse WTP enhancement request in progress].  
+
*We are not blocked from using Eclipse WTP to manage the WebSphere 6.1 server, but without this plugin we will need to attach manually to port 5005 of a running WebSphere server that was started in debug mode outside of the Eclipse IDE - we will use this alternate debug approach.
+
  
==WebSphere Configuration Changes==
+
=== OS ===
WebSphere configuration modifications can be done on the admin console.
+
  
https://localhost:9043/ibm/console/login.do?action=secure
+
*I am running this on both a 32-bit P630 2Gb machine and a Corei7 64-bit Windows7 12Gb machine - Note: '''installing the 32 bit version of WebSphere 7 on a 64-bit OS will require a full reboot of the server before you can start the container'''.
 +
*Note: Developing/Debugging an enterprise application works excellent if you use IBM Rational Developer as the Eclipse based IDE where 7.0 server support currently exists. However if you wish to debug from an unenhanced standard Eclipse 3.5 EE IDE you must run through some hoops and export your EAR manually, deploy/update it in the admin console and attach to the debuggable process manually. In other application servers such as WebLogic, OC4J, Glassfish, Tomcat and even WebSphere 6.0 this process is handled automatically for you via an eclipse plugin.
  
==JNDI Datasource Setup==
+
== Prerequisites ==
  
===Global Scoped Datasource Setup===
+
=== <font color="#008000">Install Eclipse EE</font> ===
  
==Persistence JAR location==
+
*I installed a clean version of Eclipse Galileo 3.5 SR2 EE Edition (32-bit) (April 2010) on a Window 7 64-bit install where the default JRE was the 64-Bit server version of the SUN JVM. I therefore needed to override the default ''java.exe'' by specifying the following shortcut override
WebSphere 6.1 (with EJB3 fixpack) comes with JPA support and will not need any other reference to the 1.0 specification persistence.jar
+
  
==EclipseLink JAR location==
+
<source lang="java">
*The eclipselink.jar will need to be setup as a shared library in the admin console off of the environment subtree.  The actual path to eclipselink.jar can be anything - I use the one built from SVN.
+
C:\eclipse35-32bit-home\eclipse.exe -vm c:/jdk1.6.0_32-bit/bin/java.exe
*Reference the full classpath to a copy of eclipselink.jar using a global scope.
+
</source>
[[Image:Was61_admin_env_shared_lib1.JPG]]
+
*Save the shared-library change and restart the server.
+
[[Image:Was61_admin_env_shared_lib2.JPG]]
+
  
==JDBC JAR location==
+
*Default [[EclipseLink/Development/Testing/Prereq#Recommended_eclipse.ini_settings_for_EclipseLink|eclipse.ini]] settings must be modified as referenced.
  
==Create J2EE application==
+
=== <font color="#008000">Install a Database</font> ===
  
==Persistence.xml==
+
*We will be using a remote '''Oracle 11''' instance as well as a ''local'' '''[[EclipseLink/Examples/JPA/Derby|Derby 10.5.3.0]]''' instance or the embedded '''Derby''' instance that comes with WebSphere.
The WebSphere 6.1 server is defined as '''"WebSphere_6_1"'''
+
 
 +
=== <font color="#008000">Install WebSphere 7.0</font> ===
 +
 
 +
*I installed the commercial '''7.0.0.0''' version of IBM WebSphere 7 and then the '''7.0.0.5''' '''fixpack in 7.0.0-WS-WAS-WinX32-FP0000005.pak''' using the ''7.0.0.5-WS-UPDI-WinIA32.zip'' installer.
 +
*[[Image:Ibm websphere fixpack 7001 result.JPG]]
 +
 
 +
=== Install WebSphere Eclipse 3.4 Server Plugin - unusable ===
 +
 
 +
We will first see if the WebSphere 6.0 or 6.1 plugin works with WebSphere 7.0 - it fails on missing jar files that are not present in 7.0. The WebSphere 6.1 Eclipse WTP server plugin is not shipped by default with Eclipse (WebSphere 6.0 for JEE 1.4 is).
 +
 
 +
*'''Note: The WebSphere 6.1 plugin for Eclipse WTP is currently being developed - see the following [http://bugs.eclipse.org/160220 Eclipse WTP enhancement request 160220 in progress].'''
 +
*We are not blocked from using Eclipse WTP to manage the WebSphere 6.1 server, but without this plugin we will need to attach manually to port 7781 of a running WebSphere server that was started in debug mode outside of the Eclipse IDE - we will use this alternate debug approach.
 +
*<font color="#ff0000">If you try to stub out the 73 jars required by the WebSphere 6.0 plugin to make it work with a WebSphere 7.0 server - you will get the following exception '''starting''' WebSphere from Eclipse.</font> - ''so don't do it''
 +
 
 +
<source lang="java">com.ibm.ws.exception.ConfigurationError: java.lang.Exception: Cannot find BundleContext for service com.ibm.ws.runtime.config.ConfigServiceImpl
 +
at com.ibm.ws.runtime.WsServerImpl.bootConfigService(WsServerImpl.java:335)
 +
at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:171)
 +
</source>
 +
 
 +
== WebSphere Configuration Changes ==
 +
 
 +
*WebSphere configuration modifications can be done on the admin console .
 +
**http://localhost:9060/ibm/console/
 +
**Which redirects to
 +
***https://localhost:9043/ibm/console/login.do?action=secure
 +
***or if a secure login was not selected
 +
***http://localhost:9060/ibm/console/unsecureLogon.jsp
 +
 
 +
== JNDI Datasource Setup ==
 +
 
 +
=== Global Scoped Datasource Setup ===
 +
 
 +
*We will ''for now'' use the already configured JNDI name '''"DefaultDatasource"'''.
 +
*Note the check box '''"Use this data source in container managed persistence (CMP)"''' that allows us to use this TX datasource for all our container managed deployments below.
 +
 
 +
[[Image:DefaultDatasource derby on websphere7.JPG]]
 +
 
 +
== Downloading EclipseLink Libraries ==
 +
 
 +
=== Download EclipseLink using HTTP - recommended ===
 +
 
 +
*Proceed to the following URL and download the latest eclipselink.zip which contains everything you need.
 +
**http://www.eclipse.org/eclipselink/downloads/index.php
 +
***'''Click on the "EclipseLink Installer Zip''' link which resolves to http://www.eclipse.org/downloads/download.php?file=/rt/eclipselink/releases/n.n.n/eclipselink-n.n.n.zip
 +
*Expand the zip file and get the following 2 files
 +
**eclipselink-*\eclipselink\jlib\eclipselink.jar
 +
**eclipselink-*\eclipselink\jlib\jpa\javax.persistence_*.jar
 +
 
 +
=== Download EclipseLink using Maven ===
 +
 
 +
See the repository on http://www.eclipse.org/eclipselink/downloads/index.php
 +
 
 +
=== Download EclipseLink using SVN - developers only ===
 +
 
 +
*Get the following ''<font color="#0000ff">eclipselink.jar</font>'' and ''<font color="#0000ff">javax.persistence*.jar</font>'' from http://www.eclipselink.org ready for your EclipseLink shared library.
 +
**The following page details four different ways to either obtain the binary jars or download the source and build them yourself with an anon account.
 +
**http://wiki.eclipse.org/EclipseLink/Source
 +
 
 +
= Container Managed and Application Managed Scenarios =
 +
 
 +
*The steps below detail what needs to be done to migrate an existing JPA enterprise application to use a JPA provider other than the shipped '''OpenJPA''' - like the '''org.eclipse.persistence.jpa.PersistenceProvider''' provider.
 +
*The following table summarizes the type of test, server modifications and results for verious container managed and application managed EntityManager deployments on the IBM WebSphere 7 server.
 +
 
 +
{| class="FCK__ShowTableBorders"
 +
|-
 +
! UC# DI#
 +
! Test Example-Description
 +
! Container-Managed vs Application-Managed
 +
! Injected-EMF vs Persistence bootstrap
 +
! JTA, non-JTA, RESOURCE _LOCAL Datasource
 +
! Entities, PU in utility JAR
 +
! Entities, PU in EJB JAR
 +
! Entities, PU in WAR
 +
! '''WAS console <font color="#ff0000">parent-last</font> Classloader override'''
 +
! Server modifications?
 +
! '''persistence.xml 2.0 XSD Schema'''
 +
! '''Weaving entities'''
 +
! '''Runs JPA2 Impl (shipped with EclipseLink 1.2 only)'''
 +
! '''Runs JPA2 Impl (shipped with EclipseLink 2.0 only) - IE: CriteriaBuilder'''
 +
|- bgcolor="#efefcc"
 +
| [[EclipseLink/Examples/JPA/WebSphere7 Web Tutorial#EclipseLink_library_in_Server.2Flib|#1]]
 +
| <font color="#008000">Container-Managed PU in EAR(EJB,WAR)</font> - working with server mod
 +
| container
 +
| injected @PersistenceContext EM on SLSB
 +
| JTA (derby XA)
 +
|
 +
| PU in EJB
 +
|
 +
| n/c
 +
| eclipselink.jar in&nbsp;%server%/lib
 +
| <font color="#ff0000">1.0 only</font>
 +
| <font color="#008000">'''Weaved as 1.0'''</font>
 +
| &nbsp;?
 +
| &nbsp;?
 +
|- bgcolor="#efefcc"
 +
| [[EclipseLink/Examples/JPA/WebSphere7 Web Tutorial#Container_Managed_EclipseLink_library_in_EAR|#2]]
 +
| <font color="#008000">Container-Managed PU in EAR(EJB,WAR)</font> - with eclipselink.jar in EAR
 +
| container
 +
| injected @PersistenceContext EM on SLSB
 +
| JTA (derby XA network 10.5.3.0)
 +
|
 +
| PU in EJB
 +
|
 +
| n/c
 +
| none
 +
| <font color="#ff0000">1.0 only</font>
 +
| <font color="#008000">'''Weaved as 1.0'''</font>
 +
| &nbsp;?
 +
| &nbsp;?
 +
|- bgcolor="#efefef"
 +
| [[EclipseLink/Examples/JPA/WebSphere7 Web Tutorial#.40PersistenceUnit_EMF_injection_on_WAR_Servlet|#3]]
 +
| <font color="#008000">Application-Managed PU in EAR(WAR)</font> - working with no server mods
 +
| application
 +
| injected @PersistenceUnit on Servlet
 +
| RESOURCE_LOCAL (derby network XA)
 +
|
 +
|
 +
| PU in WAR
 +
| n/c
 +
| eclipselink.jar, JPA persistence jar in EAR
 +
| <font color="#ff0000">1.0 only</font>
 +
| <font color="#008000">'''Weaved as 1.0'''</font>
 +
| &nbsp;?
 +
| &nbsp;?
 +
|}
 +
 
 +
== Configuration ==
 +
 
 +
*<font color="#ff0000">'''This section is currently undergoing review and minor editing as more deployment scenarios are tested today (20100419)'''</font>
 +
*The following section details investigations on what configurations work when using the '''EclipseLink''' JPA provider on the '''IBM WebSphere 7''' Application Server. The test deployments are configured around ''<font color="#008000">container managed</font>'' EARs that require server modification such as creating a global shared library or placing the eclipselink.jar library directly in the '''%SERVER%/lib''', and ''<font color="#0000ff">application managed</font>'' EARs that do not require any server modification as they ship the required libraries as part of the EAR.
 +
 
 +
=== EAR Source ===
 +
 
 +
*The following [https://bugs.eclipse.org/bugs/attachment.cgi?id=165341 EAR attachment] for bug# [http://bugs.eclipse.org/309201 309201] can be used as source until this project is checked into SVN.
 +
*Note: eclipselink.jar must be readded to the EAR in the position of '''EAR/APP-INF/lib/eclipselink.jar'''
 +
*URL
 +
**http://192.168.0.165:9080/enterprise/FrontController?action=demo&amp;rnd=4343434359
 +
 
 +
=== Publishing the EAR ===
 +
 
 +
*On WebSphere we use the standard stop|update|start commands on the ''Applications | Application Types | WebSphere enterprise applications''' console page in our case accessed via http://xps435:9060/ibm/console/login.do
 +
 
 +
== Container Managed ==
 +
 
 +
=== EAR configuration ===
 +
 
 +
*standard @EJB statless session bean injected on Servlet client, the EJB bean is @PersistenceContext injected with a container managed EntityManager using a transactional datasource (in this case derby)
 +
*Server startup logs
 +
<pre>WebSphere Platform 7.0.0.5 [BASE 7.0.0.5 cf050926.18] running with process name beowulf5Node01Cell\beowulf5Node01\server1 and process id 2928
 +
Host Operating System is Windows XP, version 5.1 build 2600 Service Pack 3
 +
Java version = 1.6.0, Java Compiler = j9jit24, Java VM name = IBM J9 VM
 +
</pre>
 +
=== EclipseLink library as Global Shared Library ===
 +
 
 +
*Here a developer with access to the servers' console would add a global scope library that references an external '''eclipselink.jar'''.
 +
*This works the same as the option below.
 +
 
 +
=== <font color="#008000">'''EclipseLink library in Server/lib'''</font> ===
 +
 
 +
*Placing the eclipselink.jar library directly on the server in the '''%SERVER%/lib''' directory and restarting the server will allow container managed deployments of EclipseLink applications following the JPA 1.0 specification to inject and function correctly.
 +
 
 +
==== Predeploy, deploy and runtime logs ====
 +
 
 +
<source lang="java">
 +
[4/16/10 10:26:39:484 EDT] 0000000a SystemOut O [EL Finest]: 2010-04-16 10:26:39.343--ServerSession(112920251)--Thread(Thread[server.startup : 1,5,main])--Begin predeploying Persistence Unit example; session jar:file:/C:/opt/was7001/AppServer/profiles/AppSrv01/installedApps/beowulf5Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Initial; factoryCount 0
 +
[4/16/10 10:26:40:218 EDT] 0000000a SystemOut O [EL Finer]: 2010-04-16 10:26:40.218--ServerSession(112920251)--Thread(Thread[server.startup : 1,5,main])--Class [org.eclipse.persistence.example.jpa.server.business.Cell] registered to be processed by weaver.
 +
[4/16/10 10:26:40:312 EDT] 0000000a SystemOut O [EL Finest]: 2010-04-16 10:26:40.312--ServerSession(1551588475)--Thread(Thread[server.startup : 1,5,main])--End predeploying Persistence Unit exampleAM; session jar:file:/C:/opt/was7001/AppServer/profiles/AppSrv01/installedApps/beowulf5Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_exampleAM; state Predeployed; factoryCount 1
 +
[4/16/10 10:26:44:078 EDT] 0000000a EJBContainerI I WSVR0057I: EJB jar started: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar
 +
[4/16/10 10:27:23:781 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:23.781--ServerSession(112920251)--Thread(Thread[WebContainer : 1,5,main])--Begin weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/16/10 10:27:23:843 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:23.843--ServerSession(112920251)--Thread(Thread[WebContainer : 1,5,main])--Weaved persistence (PersistenceEntity) [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/16/10 10:27:23:843 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:23.843--ServerSession(112920251)--Thread(Thread[WebContainer : 1,5,main])--Weaved fetch groups (FetchGroupTracker) [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/16/10 10:27:23:843 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:23.843--ServerSession(112920251)--Thread(Thread[WebContainer : 1,5,main])--End weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/16/10 10:27:26:953 EDT] 00000012 SystemOut O [EL Config]: 2010-04-16 10:27:26.953--ServerSession(112920251)--Connection(292491631)--Thread(Thread[WebContainer : 1,5,main])--Connected: jdbc:derby:C:\opt\was7001\AppServer\profiles\AppSrv01/installedApps/beowulf5Node01Cell/DefaultApplication.ear/DefaultDB
 +
[4/16/10 10:27:27:312 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:27.312--UnitOfWork(67175425)--Thread(Thread[WebContainer : 1,5,main])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@562176386( id: null state: null left: null right: null parent: HashSet@562700682 references: HashSet@562700682).
 +
[4/16/10 10:27:27:359 EDT] 00000012 SystemOut O [EL Fine]: 2010-04-16 10:27:27.359--ClientSession(488447261)--Connection(18219286)--Thread(Thread[WebContainer : 1,5,main])--INSERT INTO EL_CELL (STATE, TSEQ, ACELLATTRIBUTE_ID, RIGHT_ID) VALUES (?, ?, ?, ?)
 +
</source>
 +
 
 +
=== <font color="#008000">Container Managed EclipseLink library in EAR</font> ===
 +
 
 +
*This is an interesting use case where the eclipselink JPA library is included locally in the EAR ''(requiring no server modifications)'' but the persistence unit itself is container managed by '''@PersistenceContext''' EntityManager Proxy injection on a ''stateless session bean''.
 +
*The following [https://bugs.eclipse.org/bugs/attachment.cgi?id=165341 EAR attachment] for bug# [http://bugs.eclipse.org/309201 309201] can be used as source until this project is checked into SVN.
 +
*Note: eclipselink.jar must be readded to the EAR in the position of '''EAR/APP-INF/lib/eclipselink.jar'''
 +
 
 +
==== Injected EntityManager on the SSB ====
 +
 
 +
*We get a <font color="#008000">'''JPATxEntityManager@14001400'''</font> entityManager instance injected from the WebSphere container - this looks like a proxy wrapper for our EntityManagerImpl. - Normally I would '''<font color="#ffa500">debug</font>''' this to verify but I am having difficulty attaching to port 7777 using my own instructions for WebSphere 6.1
 +
 
 +
<source lang="java">
 +
[4/19/10 12:07:22:106 EDT] 00000028 SystemOut O [EL Example]: enterprise: ApplicationService query: select object(e) from Cell e on
 +
EM: JPATxEntityManager@14001400[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example,
 +
org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
</source>
 +
 
 +
==== Insertion/Persist Testing ====
 +
 
 +
*The following screen captures highlight our results of doing ''entity insertion'' on this custom container managed persistence unit detailed below.
 +
*after a read/ReadAllQuery of 5 existing entities and insertion/Persist of an additional 5...
 +
 
 +
[[Image:Browser cap jpa1 persistenceContext injected em on slsb jta derby.JPG]]
 +
 
 +
*inserting another 5 in a 2nd transaction using a different injected entityManager but the same JPAtxEntityManager proxy.
 +
 
 +
[[Image:Browser cap jpa1 persistenceContext injected em on slsb jta derby after 2nd insert.JPG]]
 +
 
 +
==== Configuration ====
 +
 
 +
===== Console Overrides =====
 +
 
 +
*None - I did not override the '''Class Loader Order''' - it is still set to ''Classes loaded with parent class loader first''.
 +
 
 +
===== EclipseLink library in EAR =====
 +
 
 +
*org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR
 +
**EarContent
 +
***APP-INF
 +
****lib
 +
*****'''<font color="#ff0000">eclipselink.jar</font> - note there is no eclipselink.jar on the server.'''
 +
 
 +
====== MANIFEST.MF ======
 +
 
 +
*Place the following path to the included '''eclipselink.jar''' in your ejb.jar(s) <font color="#008000">'''ejbModule/META-INF/MANIFEST.MF'''</font> file. This is the recommended approach where you update the manifest that is at the root of where your '''entities''' are - in this case as part of the ejb.jar.
 +
*In my example application, there are 3 MANIFEST.MF files, one on the WAR, one on the ejb.jar and one on the EAR.
 +
**''EAR/META-INF/MANIFEST.MF''
 +
**'''EJB/ejbModule/META-INF/MANIFEST.MF''' - update this one to point to the eclipselink.jar in the ''EAR/APP-INF/lib'' directory.
 +
**''WAR/WebContent/META-INF/MANIFEST.MF''
 +
*As a recommended test I removed all 3 manifest entries below and received an expected <font color="#ff0000">Injection failure</font> - putting the ejb.jar(s) manifest back to reference eclipselink.jar allowed us to successully inject an '''EclipseLink''' JPA provider EntityManagerImpl instance instead of the default OpenJPA provider's instance.
 +
 
 +
<source lang="java">
 +
Manifest-Version: 1.0
 +
Class-Path: APP-INF/lib/eclipselink.jar
 +
</source>
 +
 
 +
*Eclipse can be used to format your manifest file by selecting the eclipselink and other dependency libraries in the EJB project properties dialog
 +
 
 +
[[Image:Eclipse ejb container managed project manifest classpath to eclipselink jar in ear .JPG]]
 +
 
 +
===== Stateless Session Bean =====
 +
 
 +
<source lang="java">
 +
@Local
 +
@Stateless
 +
public class ApplicationService implements ApplicationServiceLocal {
 +
@PersistenceContext(unitName="example", type=PersistenceContextType.TRANSACTION)
 +
private EntityManager entityManager;
 +
...
 +
// with no transaction or entityManager application management - all callbacks handled by the container
 +
public boolean insertObjects(List<Cell> classes) {
 +
...
 +
entityManager.persist(classes.get(i));
 +
</source>
 +
 
 +
===== Servlet client =====
 +
 
 +
<source lang="java">
 +
public class FrontController extends HttpServlet implements Servlet {
 +
@EJB(beanName="ApplicationService")
 +
public ApplicationServiceLocal applicationService;
 +
</source>
 +
 
 +
===== persistence.xml in ejb.jar =====
 +
 
 +
*Note: you will need a populated schema - the best way to do this is to enable the ddl-generation properties in your persistence.xml - however for Derby (on WebSphere) and Oracle (in general because of implicit auto-commit for CM TX datasource) - I am able to only do this in a separate [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.common.ddlgen SE JPA app] - see the generic DDL generation project in SVN that has the same enties and will create your schema and propopulate your Derby database for you. Normally this is not an issue since the schema should be created by the DBA anyway.
 +
 
 +
<source lang="xml">
 +
<persistence-unit name="example" transaction-type="JTA">
 +
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
 +
<jta-data-source>derbyXA</jta-data-source> <!-- custom local TX 10.5.3.0 derby -->
 +
<class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
 +
<class>org.eclipse.persistence.example.jpa.server.business.CellAttribute</class>
 +
<properties>
 +
<property name="eclipselink.target-server" value="WebSphere_7"/>
 +
<property name="eclipselink.target-database" value="Derby"/>
 +
<property name="eclipselink.weaving" value="true"/>
 +
<!--property name="eclipselink.ddl-generation" value="drop-and-create-tables"/-->
 +
<!--property name="eclipselink.ddl-generation.output-mode" value="database"/-->
 +
<property name="eclipselink.logging.level" value="FINEST"/>
 +
</properties>
 +
</persistence-unit>
 +
</source>
 +
 
 +
==== Logs ====
 +
 
 +
<source lang="java">
 +
[4/19/10 12:56:51:468 EDT] 0000001a ApplicationMg A WSVR0204I: Application: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR Application build level: Unknown
 +
[4/19/10 12:56:51:858 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 12:56:51.838--ServerSession(104924737)--Thread(Thread[WebContainer : 6,5,main])--Begin predeploying Persistence Unit example; session jar:file:/C:/opt/was7b/AppServer/profiles/AppSrv01/installedApps/xps435Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Initial; factoryCount 0
 +
[4/19/10 12:56:52:448 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 12:56:52.448--ServerSession(104924737)--Thread(Thread[WebContainer : 6,5,main])--End predeploying Persistence Unit example; session jar:file:/C:/opt/was7b/AppServer/profiles/AppSrv01/installedApps/xps435Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Predeployed; factoryCount 1
 +
[4/19/10 12:56:52:458 EDT] 0000001a EJBContainerI I WSVR0037I: Starting EJB jar: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar
 +
[4/19/10 12:56:52:458 EDT] 0000001a EJBContainerI I CNTR0167I: The server is binding the org.eclipse.persistence.example.jpa.server.business.ApplicationServiceLocal interface of the ApplicationService enterprise bean in the org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar module of the org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR application. The binding location is: ejblocal:org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar/ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationServiceLocal
 +
[4/19/10 12:56:52:478 EDT] 0000001a EJBContainerI I WSVR0057I: EJB jar started: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar
 +
[4/19/10 12:56:52:488 EDT] 0000001a webapp I com.ibm.ws.webcontainer.webapp.WebGroupImpl WebGroup SRVE0169I: Loading Web Module: enterprise.
 +
[4/19/10 12:56:52:508 EDT] 0000001a WASSessionCor I SessionContextRegistry getSessionContext SESN0176I: Will create a new session context for application key default_hostenterprise
 +
[4/19/10 12:56:52:528 EDT] 0000001a webcontainer I com.ibm.ws.wswebcontainer.VirtualHost addWebApplication SRVE0250I: Web Module enterprise has been bound to default_host[*:9080,*:80,*:9443,*:5060,*:5061,*:443].
 +
[4/19/10 12:56:52:528 EDT] 0000001a ApplicationMg A WSVR0221I: Application started: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR
 +
[4/19/10 12:56:52:528 EDT] 0000001a CompositionUn A WSVR0191I: Composition unit WebSphere:cuname=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR in BLA WebSphere:blaname=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR started.
 +
 
 +
>action
 +
http://127.0.0.1:9080/enterprise/FrontController?action=demo&rnd=.04393939419
 +
[4/19/10 12:57:42:028 EDT] 00000019 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR] [/enterprise] [FrontController]: Initialization successful.
 +
[4/19/10 12:57:42:028 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.028--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--Begin weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.078--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--Weaved persistence (PersistenceEntity) [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.078--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--Weaved fetch groups (FetchGroupTracker) [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.078--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--End weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService.insertObjects() em: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService persisting: org.eclipse.persistence.example.jpa.server.business.Cell@1706321332( id: null state: null left: null right: null parent: HashSet@1706845628 references: HashSet@1706845628) on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
[4/19/10 12:57:42:088 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.078--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--Begin deploying Persistence Unit example; session jar:file:/C:/opt/was7b/AppServer/profiles/AppSrv01/installedApps/xps435Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Predeployed; factoryCount 1
 +
[4/19/10 12:57:42:158 EDT] 00000019 SystemOut O [EL Info]: 2010-04-19 12:57:42.158--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--EclipseLink, version: Eclipse Persistence Services - 2.1.0.qualifier
 +
[4/19/10 12:57:42:168 EDT] 00000019 SystemOut O [EL Config]: 2010-04-19 12:57:42.168--ServerSession(104924737)--Connection(1708484053)--Thread(Thread[WebContainer : 5,5,main])--connecting(DatabaseLogin(
 +
platform=>DerbyPlatform
 +
user name=> ""
 +
connector=>JNDIConnector datasource name=>null
 +
))
 +
[4/19/10 12:57:42:418 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.418--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--End deploying Persistence Unit example; session jar:file:/C:/opt/was7b/AppServer/profiles/AppSrv01/installedApps/xps435Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Deployed; factoryCount 1
 +
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.468--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--client acquired
 +
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.468--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--TX binding to tx mgr, status=STATUS_ACTIVE
 +
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.468--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@1706321332( id: null state: null left: null right: null parent: HashSet@1706845628 references: HashSet@1706845628).
 +
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService persisting: org.eclipse.persistence.example.jpa.server.business.Cell@1706845628( id: null state: null left: null right: null parent: HashSet@826618180 references: HashSet@826618180) on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.468--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--begin unit of work commit
 +
[4/19/10 12:57:42:478 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.478--ClientSession(1595039506)--Thread(Thread[WebContainer : 5,5,main])--TX beginTransaction, status=STATUS_ACTIVE
 +
[4/19/10 12:57:42:478 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.478--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--Execute query InsertObjectQuery(org.eclipse.persistence.example.jpa.server.business.Cell@1708418516( id: null state: null left: null right: null parent: HashSet@1707894220 references: HashSet@1707894220))
 +
[4/19/10 12:57:42:488 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.488--ClientSession(1595039506)--Thread(Thread[WebContainer : 5,5,main])--reconnecting to external connection pool
 +
[4/19/10 12:57:42:498 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.498--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--Execute query DataModifyQuery()
 +
[4/19/10 12:57:42:508 EDT] 00000019 SystemOut O [EL Fine]: 2010-04-19 12:57:42.508--ClientSession(1595039506)--Connection(1358319862)--Thread(Thread[WebContainer : 5,5,main])--INSERT INTO EL_CELL_EL_CELL (references_ID, peers_ID) VALUES (?, ?)
 +
bind => [9, 6]
 +
[4/19/10 12:57:42:528 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.528--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--TX afterCompletion callback, status=COMMITTED
 +
[4/19/10 12:57:42:538 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.538--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--end unit of work commit
 +
[4/19/10 12:57:42:538 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService query: select object(e) from Cell e on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
[4/19/10 12:57:43:008 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.008--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--client acquired
 +
[4/19/10 12:57:43:018 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.018--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--TX binding to tx mgr, status=STATUS_ACTIVE
 +
[4/19/10 12:57:43:018 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:43.018--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--Execute query ReadAllQuery(referenceClass=Cell sql="SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL")
 +
[4/19/10 12:57:43:058 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:43.058--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--Register the existing object org.eclipse.persistence.example.jpa.server.business.Cell@1081950333( id: 2 state: null left: null right: null parent: HashSet@85329174 references: HashSet@85329174)
 +
[4/19/10 12:57:43:078 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.078--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--TX beforeCompletion callback, status=STATUS_ACTIVE
 +
[4/19/10 12:57:43:078 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.078--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--begin unit of work commit
 +
[4/19/10 12:57:43:088 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.088--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--initialize identitymaps
 +
[4/19/10 12:57:43:088 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.088--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--TX afterCompletion callback, status=COMMITTED
 +
[4/19/10 12:57:43:088 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.088--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--end unit of work commit
 +
[4/19/10 12:57:43:088 EDT] 00000019 SystemOut O [EL Example]: enterprise: Object: org.eclipse.persistence.example.jpa.server.business.Cell@1366970746( id: 1 state: null left: null right: null parent: HashSet@-379786916 references: HashSet@-379786916)
 +
 
 +
 
 +
>2nd insert
 +
http://127.0.0.1:9080/enterprise/FrontController?action=demo&rnd=.04393939420
 +
[4/19/10 12:58:37:468 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService.insertObjects() em: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
[4/19/10 12:58:37:468 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService persisting: org.eclipse.persistence.example.jpa.server.business.Cell@1281379424( id: null state: null left: null right: null parent: HashSet@1281903720 references: HashSet@1281903720) on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
[4/19/10 12:58:37:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:58:37.468--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--client acquired
 +
[4/19/10 12:58:37:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:58:37.468--UnitOfWork(1285901477)--Thread(Thread[WebContainer : 5,5,main])--TX binding to tx mgr, status=STATUS_ACTIVE
 +
[4/19/10 12:58:37:478 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:58:37.468--UnitOfWork(1285901477)--Thread(Thread[WebContainer : 5,5,main])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@1281379424( id: null state: null left: null right: null parent: HashSet@1281903720 references: HashSet@1281903720).
 +
[4/19/10 12:58:37:478 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService persisting: org.eclipse.persistence.example.jpa.server.business.Cell@1281903720( id: null state: null left: null right: null parent: HashSet@-448207544 references: HashSet@-448207544) on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService query: select object(e) from Cell e on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
 +
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:58:37.608--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--client acquired
 +
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:58:37.608--UnitOfWork(374150733)--Thread(Thread[WebContainer : 5,5,main])--TX binding to tx mgr, status=STATUS_ACTIVE
 +
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:58:37.608--UnitOfWork(374150733)--Thread(Thread[WebContainer : 5,5,main])--Execute query ReadAllQuery(referenceClass=Cell sql="SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL")
 +
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:58:37.608--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--reconnecting to external connection pool
 +
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Fine]: 2010-04-19 12:58:37.608--ServerSession(104924737)--Connection(57672560)--Thread(Thread[WebContainer : 5,5,main])--SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL
 +
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:58:37.608--UnitOfWork(374150733)--Thread(Thread[WebContainer : 5,5,main])--Register the existing object org.eclipse.persistence.example.jpa.server.business.Cell@1081950333( id: 2 state: null left: null right: null parent: HashSet@85329174 references: HashSet@85329174)
 +
 
 +
</source>
 +
 
 +
=== <font color="#ff0000">''No EclipseLink library on the Server or the EAR''</font> ===
 +
 
 +
*This is not a valid configuration because the EclipseLink JPA provider library is needs to be added either on the server or via the APP-LIB directory of the EAR for Container or Application managed scenarios.
 +
*You will see the following exception if you attempt to use the '''org.eclipse.persistence.jpa.PersistenceProvider''' in this case. This forms a good base case failure test upon which the other valid scenarios can be verified against.
 +
**javax.ejb.EJBException: Injection failure; nested exception is: java.lang.IllegalStateException: EntityManagerFactory has not been created for PU&nbsp;: PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example
 +
 
 +
== Application Managed ==
 +
 
 +
*The primary use case that requires an appplication managed entityManager is one where the application developer does not have access to the server to create global or local scope '''Shared Libraries'''. In this case all library configuration and classloader scope changes must be done inside the EAR itself.
 +
*For either the developer that has access to the deployment workflow on the WAS console - We can modify the classloader to load the '''parent last''' using the following [http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.zseries.doc/info/zseries/ae/trun_classload_entapp.html procedure from DeveloperWorks].
 +
*See '''Enterprise Applications &gt; org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR &gt; Class loader''' in...
 +
 
 +
[[Image:Was console modify application classloader parent last.JPG]]
 +
 
 +
=== EAR configuration ===
 +
 
 +
*standard Persistence static bootstrap EMF on the servlet or @PersistenceUnit injection on the servlet with a non-JTA datasource or direct JDBC connection (in this case derby)
 +
 
 +
=== Eclipselink library in EAR ===
 +
 
 +
==== Static Persistence bootstrap EMF creation in WAR Servlet ====
 +
 
 +
==== <font color="#ff0000">''Static Persistence bootstrap EMF creation in EJB Session Bean''</font> ====
 +
 
 +
*'''20100420: this scenario may actually work if the MANIFEST.MF points to the correct APP-INF/lib/eclipselink.jar''' - I just need time to revert the testing EAR and verify this.
 +
*placing the eclipselink.jar in the EAR and attempting to use the SE Persistence bootstrap class to create an EMF on a '''Stateless Session Bean - in the EJB.jar''' - ''(on the EJB container instead of the WEB container)'' does not work because the classloader position of the eclipselink.jar is not visible to the '''JPA 1.0 persistence library''' that ships with the server higher up.
 +
*You see the following warnings
 +
 
 +
<source lang="java">
 +
[4/16/10 11:23:09:218 EDT] 0000001d SystemErr R WARNING: Unable to load persistence provider "org.eclipse.persistence.jpa.PersistenceProvider" due to "java.lang.ClassNotFoundException: org.eclipse.persistence.jpa.PersistenceProvider"
 +
[4/16/10 11:23:09:218 EDT] 0000001d SystemErr R WARNING: Found unrecognized persistence provider "org.eclipse.persistence.jpa.PersistenceProvider" in place of OpenJPA provider. This provider's properties will not be used.
 +
</source>
 +
 
 +
*You will get a '''null''' ''EntityManagerFactory'' when attempting
 +
 
 +
<source lang="java">EntityManagerFactory emf = Persistence.createEntityManagerFactory("example");</source>
 +
 
 +
==== @PersistenceUnit EMF injection on WAR Servlet ====
 +
 
 +
*This is the recommended application managed way of getting an EMF.
 +
 
 +
===== <font color="#008000">'''JPA 1.0 persistence.xml'''</font> =====
 +
 
 +
*Both '''Persistence''' boostrap and '''@PersistenceUnit''' injection work well on an application managed EclipseLink JPA 1.0 client like a servlet in the WAR in an EAR on WebSphere 7.0.
 +
 
 +
====== WebContent/META-INF/MANIFEST.MF ======
 +
 
 +
*Manifest entry on the WAR must reference the libraries in the EAR project
 +
**Class-Path: APP-INF/lib/eclipselink.jar
 +
***APP-INF/lib/javax.persistence_2.0.0.v201002051058.jar
 +
 
 +
====== Servlet client ======
 +
 
 +
*Injection of EMF on servlet
 +
 
 +
<source lang="java">
 +
public class FrontController extends HttpServlet implements Servlet {
 +
@PersistenceUnit(unitName="example-am1")
 +
private EntityManagerFactory emf;
 +
</source>
 +
 
 +
====== Persistence.xml 1.0 version ======
  
*JTA : Put persistence.xml beside your JPA entities in ''yourProjectEJB/ejbModule/META-INF'' 
 
 
<source lang="xml">
 
<source lang="xml">
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
+
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
  <persistence-unit name="unified" transaction-type="JTA">
+
<!-- persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0"-->
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
<persistence-unit name="example-am1" transaction-type="JTA">
    <jta-data-source>jdbc/__default</jta-data-source>
+
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <properties>
+
<!-- shared-cache-mode>NONE</shared-cache-mode--> <!-- JPA 2.0 PFD only -->
      <property name="eclipselink.target-server" value="WebSphere_6_1"/>
+
<jta-data-source>DefaultDatasource</jta-data-source>
      <property name="eclipselink.logging.level" value="FINEST"/>
+
<class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
      <property name="eclipselink.session-name" value="eclipselinkwls"/>
+
<class>org.eclipse.persistence.example.jpa.server.business.CellAttribute</class>
    </properties>
+
<properties>
  </persistence-unit>
+
<property name="eclipselink.target-server" value="WebSphere_7"/>
 +
<property name="eclipselink.logging.level" value="FINEST"/>
 +
</properties>  
 +
</persistence-unit>
 
</persistence>
 
</persistence>
 +
</source>
 +
 +
*Or the RESOURCE_LOCAL version
  
</source>
 
*RESOURCE_LOCAL : non-JTA : Put persistence.xml beside your JPA entities in ''yourProjectEJB/ejbModule/META-INF'' 
 
*This one is used by a local SE Java app to create and pre-populated the derby database
 
 
<source lang="xml">
 
<source lang="xml">
  <persistence-unit name="stat.create.tables" transaction-type="RESOURCE_LOCAL">
+
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
<persistence-unit name="example-am1" transaction-type="RESOURCE_LOCAL">  
    <class>entity..</class>
+
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <properties>
+
<class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
      <property name="eclipselink.jdbc.platform" value="oracle.toplink.platform.database.DerbyPlatform"/>
+
<class>org.eclipse.persistence.example.jpa.server.business.CellAttribute</class>
      <property name="eclipselink.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+
<properties>
      <property name="eclipselink.target-database" value="Derby"/>          
+
<property name="eclipselink.target-server" value="WebSphere_7"/>
      <property name="eclipselink.jdbc.url" value="jdbc:derby:C:/opt/derby104/unified;create=true"/>
+
<property name="eclipselink.weaving" value="true"/>
      <property name="eclipselink.jdbc.user" value="APP"/>
+
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
      <property name="eclipselink.jdbc.password" value="APP"/>
+
<property name="eclipselink.target-database" value="Derby"/>  
      <property name="eclipselink.logging.level" value="FINEST"/>          
+
<property name="javax.persistence.jdbc.url" value="jdbc:derby://127.0.0.1:1527/websphere;create=true"/>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
+
<property name="javax.persistence.jdbc.user" value="APP"/>
      <property name="eclipselink.ddl-generation.output-mode" value="database"/>
+
<property name="javax.persistence.jdbc.password" value="APP"/>
    </properties>
+
<!--property name="eclipselink.ddl-generation" value="drop-and-create-tables"/-->
  </persistence-unit>
+
<!--property name="eclipselink.ddl-generation.output-mode" value="database"/-->
</source>
+
<property name="eclipselink.logging.level" value="FINEST"/>
 +
</properties>  
 +
</persistence-unit>
 +
</persistence>
 +
</source>  
  
==Publish EAR==
+
====== Console logs ======
*Since the Eclipse WTP server plugin for WebSphere 6.1 is not available - we can deploy the EAR via the admin console or via python script.
+
  
===Validating the WebSphere/EclipseLink configuration===
+
*The following logs show evidence of '''Weaving''' ''(bytecode instrumentation for change tracking and cache performance)'', '''EntityManagerFactory''' and '''EntityManager''' ''EclipseLink'' JPA provider instances and their usage.
*Start the server from the command-line or via windows service.
+
===Without eclipselink.jar reference===
+
You will see the following messages if the eclipselink JPA provider jar is not on the classpath.
+
  
<pre>
+
<source lang="java">
[9/19/08 10:59:44:320 EDT] 0000001d EJBContainerI I  CNTR0167I: The server is binding the ApplicationServiceLocal interface of the ApplicationService enterprise bean in the unifiedWAS6EJB.jar module of the unifiedWAS6EAR application.  The binding location is: ejblocal:unifiedWAS6EAR/unifiedWAS6EJB.jar/ApplicationService#org.eclipse.persistence.example.unified.business.ApplicationServiceLocal
+
[4/16/10 16:21:55:359 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-16 16:21:55.359--ServerSession(439228974)--Thread(Thread[WebContainer : 4,5,main])--Begin predeploying Persistence Unit example-am1; session file:/C:/opt/was7001/AppServer/profiles/AppSrv01/installedApps/beowulf5Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseWeb.war/_example-am1; state Initial; factoryCount 0
[9/19/08 10:59:44:492 EDT] 0000001d ApplicationMg A  WSVR0221I: Application started: unifiedWAS6EAR
+
[9/19/08 10:59:48:195 EDT] 0000001c JPAPUnitInfo  E  CWWJP0009E: The server cannot create an EntityManangerFactory factory for the unified persistent unit from the org.eclipse.persistence.jpa.PersistenceProvider provider in jar:file:/C:/opt/was61/profiles/AppSrv01/installedApps/mxxxx-pc2Node01Cell/unifiedWAS6EAR.ear/unifiedWAS6EJB.jar!/ module.
+
</pre>
+
  
===With eclipselink.jar reference===
+
[4/16/10 16:23:51:640 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:51.64--ServerSession(1268927394)--Thread(Thread[WebContainer : 7,5,main])--Begin weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
The following logs will verify that predeploy of our JPA application was successful on WebSphere using EclipseLink as the JPA provider.
+
[4/16/10 16:23:51:718 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:51.718--ServerSession(1268927394)--Thread(Thread[WebContainer : 7,5,main])--Weaved persistence (PersistenceEntity) [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/16/10 16:23:51:718 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:51.718--ServerSession(1268927394)--Thread(Thread[WebContainer : 7,5,main])--Weaved fetch groups (FetchGroupTracker) [org.eclipse.persistence.example.jpa.server.business.Cell].
 +
[4/16/10 16:23:53:515 EDT] 0000001d SystemOut O Injected @PersistenceUnit: org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl@5dc85dc8
 +
[4/16/10 17:03:28:312 EDT] 00000019 SystemOut O EntityManager from Injected @PersistenceUnit: org.eclipse.persistence.internal.jpa.EntityManagerImpl@4cfc4cfc
 +
[4/16/10 16:23:53:421 EDT] 0000001d SystemOut O [EL Finer]: 2010-04-16 16:23:53.421--ServerSession(439228974)--Thread(Thread[WebContainer : 7,5,main])--Canonical Metamodel class [org.eclipse.persistence.example.jpa.server.business.Cell_] not found during initialization.
 +
[4/16/10 16:23:53:500 EDT] 0000001d SystemOut O [EL Finer]: 2010-04-16 16:23:53.5--ServerSession(439228974)--Thread(Thread[WebContainer : 7,5,main])--client acquired
 +
[4/16/10 16:23:53:515 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:53.515--UnitOfWork(758525238)--Thread(Thread[WebContainer : 7,5,main])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@165349851( id: null state: null left: null right: null parent: HashSet@165874147 references: HashSet@165874147).
 +
[4/16/10 16:23:53:859 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:53.859--UnitOfWork(859058996)--Thread(Thread[WebContainer : 7,5,main])--Execute query ReadAllQuery(referenceClass=Cell sql="SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL")
 +
...
 +
[4/19/10 9:33:35:213 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 09:33:35.213--ServerSession(1893232856)--Thread(Thread[WebContainer : 6,5,main])--Execute query ReadObjectQuery(name="left" referenceClass=Cell sql="SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL WHERE (RIGHT_ID = ?)")
 +
[4/19/10 9:33:35:213 EDT] 0000001a SystemOut O [EL Fine]: 2010-04-19 09:33:35.213--ServerSession(1893232856)--Connection(1950839879)--Thread(Thread[WebContainer : 6,5,main])--SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL WHERE (RIGHT_ID = ?)
 +
bind => [1]
 +
[4/19/10 9:33:35:243 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 09:33:35.243--ServerSession(1893232856)--Thread(Thread[WebContainer : 6,5,main])--Execute query ReadAllQuery(name="references" referenceClass=Cell sql="SELECT t1.ID, t1.STATE, t1.TSEQ, t1.RIGHT_ID, t1.ACELLATTRIBUTE_ID FROM EL_CELL_EL_CELL t0, EL_CELL t1 WHERE ((t0.peers_ID = ?) AND (t1.ID = t0.references_ID))")
 +
[4/19/10 9:33:35:243 EDT] 0000001a SystemOut O [EL Fine]: 2010-04-19 09:33:35.243--ServerSession(1893232856)--Connection(1950839879)--Thread(Thread[WebContainer : 6,5,main])--SELECT t1.ID, t1.STATE, t1.TSEQ, t1.RIGHT_ID, t1.ACELLATTRIBUTE_ID FROM EL_CELL_EL_CELL t0, EL_CELL t1 WHERE ((t0.peers_ID = ?) AND (t1.ID = t0.references_ID))
 +
bind => [1]
 +
[4/19/10 9:33:35:293 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 09:33:35.293--UnitOfWork(273879123)--Thread(Thread[WebContainer : 6,5,main])--Register the existing object org.eclipse.persistence.example.jpa.server.business.Cell@579084932( id: 4 state: null left: null right: null parent: HashSet@1550867568 references: HashSet@1550867568)
  
<pre>
+
</source>  
************ Start Display Current Environment ************
+
WebSphere Platform 6.1 [EJB3 6.1.0.17 cf170821.02] [BASE 6.1.0.17 cf170821.07]  running with process name mxxxx-pc2Node01Cell\mobrien-pc2Node01\server1 and process id 2608
+
Host Operating System is Windows XP, version 5.1 build 2600 Service Pack 2
+
Java version = J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-20080315 (JIT enabled)
+
J9VM - 20080314_17962_lHdSMr
+
JIT  - 20080130_0718ifx2_r8
+
GC  - 200802_08, Java Compiler = j9jit23, Java VM name = IBM J9 VM
+
was.install.root = C:/opt/was61
+
user.install.root = C:\opt\was61\profiles\AppSrv01
+
Java Home = C:\opt\was61\java\jre
+
ws.ext.dirs = C:/opt/was61/java/lib;C:\opt\was61\profiles\AppSrv01/classes;C:/opt/was61/classes;C:/opt/was61/lib;C:/opt/was61/installedChannels;C:/opt/was61/lib/ext;C:/opt/was61/web/help;C:/opt/was61/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime
+
Classpath = C:\opt\was61\profiles\AppSrv01/properties;C:/opt/was61/properties;C:/opt/was61/lib/startup.jar;C:/opt/was61/lib/bootstrap.jar;C:/opt/was61/lib/j2ee.jar;C:/opt/was61/lib/lmproxy.jar;C:/opt/was61/lib/urlprotocols.jar;C:/opt/was61/deploytool/itp/batchboot.jar;C:/opt/was61/deploytool/itp/batch2.jar;C:/opt/was61/java/lib/tools.jar
+
Java Library path = C:\opt\was61\java\jre\bin;.;C:\opt\was61\bin;C:\opt\was61\java\bin;C:\opt\was61\java\jre\bin
+
</pre>
+
  
===Java 1.5 compiled eclipselink.jar is required for WebSphere 6.1===
+
====== Browser Output ======
IBM WebSphere 6.1 requires that the all jars are compiled as Java 1.5 compatible class files.
+
  
If you see the following UnsupportedClassVersionError - it just means that the version of eclipselink.jar you are using is compiled for a higher JRE than WebSphere is running - In my example I rebuilt it as a Java 1.6 binary but WebSphere expects Java 1.5 classes.
+
*The following screen capture illustrates the fact that 5 entities were read from in this case a Derby 10.5.3.0 database using a RESOURCE_LOCAL @PersistenceUnit injected '''<font color="#0000ff">Application Managed EMF</font>''' on a Servlet client as part of the WAR in an EAR that contains the eclipselink.jar library embedded - essentially an SE application.
Verify what version of Java is running your WebSphere server by finding the process ID (PID) in task manager for your server and then attaching to this process using jconsole.exe
+
  
====Manifest from Broken JAR====
+
[[Image:Browser cap jpa1 persistenceUnit injected emf resource local.JPG]]
Created-By: 10.0-b19 (Sun Microsystems Inc.)
+
  
====Manifest from working JAR====
+
*After insertion of 5 new entities...
We are in luck because the Eclipse build server compiles eclipselink.jar using an  IBM PowerPC server and an IBM Java 1.5 JVM.
+
  
Created-By: 2.3 (IBM Corporation)
+
[[Image:Browser cap jpa1 persistenceUnit injected emf resource local After insert.JPG]] <source lang="java">
 +
[4/19/10 11:06:40:990 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 11:06:40.99--UnitOfWork(1284721811)--Thread(Thread[WebContainer : 5,5,main])--Execute query DataModifyQuery(sql="INSERT INTO EL_CELL_EL_CELL (references_ID, peers_ID) VALUES (?, ?)")
 +
[4/19/10 11:06:40:990 EDT] 00000019 SystemOut O [EL Fine]: 2010-04-19 11:06:40.99--ClientSession(1751476325)--Connection(593306461)--Thread(Thread[WebContainer : 5,5,main])--INSERT INTO EL_CELL_EL_CELL (references_ID, peers_ID) VALUES (?, ?)
 +
bind => [10, 7]
 +
</source>
  
Which matches the IBM 1.5 J9 JRE used by WebSphere 6.1
+
===== <font color="#ff0000">JPA 2.0 persistence.xml</font> =====
  
J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-20080315 (JIT enabled)
+
*Application Managed EAR's that define a JPA 2.0 schema reference in their '''persistence.xml''' will not deploy.
  
 +
<source lang="xml">
 +
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 +
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0">
 +
</source>
  
==Perform CRUD operations: JPQL insert and query==
+
*The following XML parsing error occurs on the server.
 +
 
 +
<source lang="java">
 +
[4/16/10 15:45:50:093 EDT] 00000016 SystemErr R com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.metadata.MetaDataException: CWWJP0040E: The persistence.xml in application org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR, module org.eclipse.persistence.example.jpa.server.websphere.EnterpriseWeb.war, has a syntax error at line number: 20, column number: 209.
 +
[4/16/10 15:45:50:093 EDT] 00000016 SystemErr R at com.ibm.ws.jpa.management.JPAApplInfo.processModulePUs(JPAApplInfo.java:185)
 +
[4/16/10 15:45:49:250 EDT] 00000016 JPAPxmlInfo E CWWJP0040E: Incorrect syntax or error detected in the persistence.xml file in application: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR, module: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseWeb.war, at line number: 20, column number: 209. The following associated error message occurred: javax.xml.bind.UnmarshalException
 +
- with linked exception:
 +
[org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'persistence' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.]
 +
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:326)
 +
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'persistence' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
 +
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
 +
</source> [[Image:App managed jpa2 ear fails to deploy on websphere 7.JPG]]
 +
 
 +
*Also, if we try using JPA 2.0 API via a persistence.xml that is defined as JPA 1.0 so it passed deployment - we will still get an expected runtime exception when we try to use JPA 2.0 commands.
 +
 
 +
<source lang="java">
 +
[4/16/10 16:08:47:578 EDT] 0000001b servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet FrontController in application org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR. Exception created : java.lang.NoSuchMethodError: javax/persistence/EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
 +
at org.eclipse.persistence.example.jpa.server.business.ApplicationManagedService.getMetamodel(ApplicationManagedService.java:139)
 +
</source>
 +
 
 +
== Persistence JAR location ==
 +
 
 +
*Where does the standard library '''plugins/com.ibm.ws.jpa.jar''' and '''runtimes/com.ibm.ws.jpa.thinclient_7.0.0.jar''' fit in? Is this a JPA spec jar or an '''OpenJPA''' implementation?
 +
 
 +
== JDBC JAR location ==
 +
 
 +
*If you are using a JDBC provider other than the 3 provided by WebSphere, you must defined all of the '''JDBC Providers''', the '''Data sources''' and the secondary '''JAAS-J2C authentication data''' sections in the admin console for your new datasource.
 +
 
 +
[[Image:Was console oracle datasource1.JPG]]
 +
 
 +
== Remote Debugging EclipseLink in WebSphere 7.0 from Eclipse 3.4 ==
 +
 
 +
The following procedure details how to attach to a debug version of IBM WebSphere 7.0 with the Eclipse 3.4 IDE.
 +
 
 +
Note: we will not be modifying startServer.bat. The java process in that script is only for server startup - if you need to debug this part of the server.
 +
 
 +
=== Modify console setup to start server in debug mode ===
 +
 
 +
*Login to the console using your admin login or a default username like ''system''
 +
**http://mobrien-pc2.st-mdc.ca.oracle.com:9064/ibm/console/login.do
 +
*Navigate to Servers | Server Types | WebSphere Application servers | server1
 +
*Navigate on the right down to Additional Properties | Debugging service
 +
*Enable JDWP by ckecking the checkbox ''Enable service at server startup"''
 +
**The default properties below will be OK unmodified
 +
***JVM debug port = 7781
 +
***JVM debug arguments = -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7781
 +
*Optionally you can add server packages if you have the source for WebSphere
 +
*We will be debugging client test code and EclipseLink API in the Eclipse IDE
 +
 
 +
[[Image:Websphere7 console debug screen.JPG]]
 +
 
 +
=== Start the WebSphere Server ===
 +
 
 +
Either run bin/startServer.bat or the following server ant test target in our suite.
 +
<pre>&lt;trunk&gt;jpa\eclipselink.jpa.test&gt;ant server-start
 +
</pre>
 +
=== Attach Eclipse 3.4 to the debug port on WebSphere 7 ===
 +
 
 +
*Right-click your test code
 +
*Debug as | Debug Configurations
 +
*select Remote Java Application
 +
*create a new config by hitting the top-left ''new launch configuration'' icon
 +
*type a name for your config and modify only the port to read 7781
 +
*''apply'' changes
 +
*click debug
 +
 
 +
[[Image:Eclipse34 remote debug websphere7 screen.JPG]]
 +
 
 +
You should see the a stack trace ready for any breakpoints in your code that are hit - or suspend an orb thread to break into the code.
 +
<pre />
 +
=== Deploy and Run EAR application ===
 +
 
 +
Depending on your breakpoints you will see a stacktrace hit in the Eclipse IDE similar to the following.
 +
<pre>VirtualAttributeTestSuite [Remote Java Application]
 +
IBM J9 VM[localhost:7781]
 +
Thread [P=833989:O=0:CT] (Running)
 +
Daemon Thread [Signal Dispatcher] (Running)
 +
...
 +
Daemon Thread [Thread-52] (Running)
 +
Daemon Thread [ORB.thread.pool&nbsp;: 0] (Running)
 +
Daemon Thread [ORB.thread.pool&nbsp;: 1] (Suspended (breakpoint at line 302 in ConcurrencyManager))
 +
ConcurrencyManager.isAcquired() line: 302
 +
ClientSession(AbstractSession).isInTransaction() line: 2405
 +
ClientSession(AbstractSession).beginTransaction() line: 538
 +
SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(Sequence, AbstractSession) line: 455
 +
SequencingManager.getNextValue(AbstractSession, Class) line: 905
 +
ClientSessionSequencing.getNextValue(Class) line: 70
 +
ObjectBuilder.assignSequenceNumber(Object, AbstractSession) line: 277
 +
RepeatableWriteUnitOfWork(UnitOfWorkImpl).assignSequenceNumber(Object, ClassDescriptor) line: 402
 +
RepeatableWriteUnitOfWork(UnitOfWorkImpl).registerNotRegisteredNewObjectForPersist(Object, ClassDescriptor) line: 3952
 +
RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(Object, ClassDescriptor) line: 359
 +
RepeatableWriteUnitOfWork(UnitOfWorkImpl).registerNewObjectForPersist(Object, Map) line: 3899
 +
EntityManagerImpl.persist(Object) line: 254
 +
JPATxEmInvocation(JPAExEmInvocation).persist(Object) line: 336
 +
JPATxEntityManager(JPAEntityManager).persist(Object) line: 123
 +
VirtualAttributeTestSuite.testInsertVirtualAttribute() line: 63
 +
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
 +
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 45
 +
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 37
 +
Method.invoke(Object, Object...) line: 599
 +
VirtualAttributeTestSuite(TestCase).runTest() line: 154
 +
VirtualAttributeTestSuite(TestCase).runBare() line: 127
 +
VirtualAttributeTestSuite(JUnitTestCase).runBareServer() line: 391
 +
TestRunnerBean.runTest(String, String, Properties) line: 87
 +
EJSRemote0SLTestRunner_ed643271.runTest(String, String, Properties) line: not available
 +
_EJSRemote0SLTestRunner_ed643271_Tie.runTest(InputStream, ResponseHandler) line: not available
 +
_EJSRemote0SLTestRunner_ed643271_Tie._invoke(String, InputStream, ResponseHandler) line: not available
 +
WSExtendedServerDelegate(ServerDelegate).dispatchInvokeHandler(InterceptorManager, ServerRequestInfoImpl, String, Object, ServerRequestReader) line: 622
 +
WSExtendedServerDelegate(ServerDelegate).dispatch(ServerRequest) line: 475
 +
ORB(ORB).process(ServerRequest) line: 504
 +
ORB.process(ServerRequest) line: 1571
 +
Connection.respondTo(RequestHandler, IIOPReader) line: 2771
 +
Connection.doWork(RequestHandler, IIOPReader) line: 2640
 +
WorkUnitImpl.doWork() line: 63
 +
PooledThread.run() line: 118
 +
ThreadPool$Worker.run() line: 1527
 +
Daemon Thread [AIO Timer Thread 1] (Running)
 +
Daemon Thread [WebContainer&nbsp;: 0] (Running)
 +
...
 +
        Daemon Thread [RT=7:P=833989:O=0:WSTCPTransportConnection[addr=10.156.52.98,port=1553,local=9104]] (Running)
 +
</pre>
 +
== References ==
  
===Browser Output===
+
*See [[EclipseLink/UserGuide/Developing JPA Projects (ELUG)|Developing JPA Projects]] in the EclipseLink User's Guide.
 +
**http://www.ibm.com/developerworks/eclipse/downloads/ganymede/
 +
*http://www.ibm.com/developerworks/eclipse/downloads/ganymede/dev.html
 +
*[http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/tejb_configpp.html WebSphere Application Server 7: Using third-party persistence providers]
 +
*[http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/websphere Instructions about installation and configuration of JPA 2.0 on WebSphere 7.0.x]
 +
*[http://old.nabble.com/Transaction-not-committing-for-JTA-Container-Managed-Transaction-in-Websphere-using-Eclipse-Link-td33316707.html#a33316707 http://old.nabble.com/Transaction-not-committing-for-JTA-Container-Managed-Transaction-in-Websphere-using-Eclipse-Link-td33316707.html#a33316707]
  
 +
== Bugs ==
  
==References==
+
*''[http://bugs.eclipse.org/309201 309201&nbsp;: EclipseLink on WebSphere 7: Container Managed and Application Managed EntityManager scenarios]''
*See [[EclipseLink/UserGuide/Developing_JPA_Projects_%28ELUG%29|Developing JPA Projects]] in the EclipseLink User's Guide.
+
*[http://bugs.eclipse.org/309975 309975&nbsp;: Examples: Update WebSphere 7 JPA EAR example tutorial in SVN]
  
 +
== History ==
  
Originated on build 20080918 - Michael O'Brien
+
*20090115: Originated on build EclipseLink 1.1 M6 - Michael O'Brien  
 +
*20100415: Updating for eclipselink.jar placement for container managed and application managed scenarios in EclipseLink enhancement # [http://bugs.eclipse.org/309201 309201]

Latest revision as of 15:03, 13 February 2012

Contents

EclipseLink JPA Deployed on IBM WebSphere 7 using Eclipse WTP

Note: This tutorial' was under construction for the next week as of 2010415 under bug# 309201. and 309975

If you want to get a small web application running quickly on WebSphere 7.0 you can use Eclipse to create the EAR and attach to a running WebSphere instance in debug mode on port 7781.

This basic example details how to use Eclipse to run/debug a minimum J2EE web application servlet using EclipseLink JPA as the persistence provider. The goal of this example is to detail the minimum steps required to run EclipseLink inside the IBM WebSphere Application Server 7.0 server using the Eclipse IDE. At this point no presentation/controller layer such as JSF, Spring or Struts will be used beyond a basic HttpServlet so we can concentrate on the the integration layer JPA setup.

The DALI project can be used to generate Entities from a schema with sequences already populated.

Tables can be populated by persisting an instance of the mode in an SE JPA persistence unit with DDL generation turned on.

The recommended configuration for running EclipseLink as the JPA provider on WebSphere 7 are the following container managed scenarios below.

QuickStart Steps

  • More details are below, but here are the main steps for advanced users via a specific config run of an EclipseLink JPA app on WebSphere 7.0.0.0 (no security).
  • Start the derby database: C:\opt\derby10530\bin\startNetworkServer.bat
  • Start WebSphere: C:\opt\was7b\AppServer\profiles\AppSrv01\bin\startServer.bat server1
  • Start the admin console: http://xps435:9060/ibm/console
  • Deploy EAR on the console:
  • Run demo servlet: http://127.0.0.1:9080/enterprise

Development Environment

Software

OS

  • I am running this on both a 32-bit P630 2Gb machine and a Corei7 64-bit Windows7 12Gb machine - Note: installing the 32 bit version of WebSphere 7 on a 64-bit OS will require a full reboot of the server before you can start the container.
  • Note: Developing/Debugging an enterprise application works excellent if you use IBM Rational Developer as the Eclipse based IDE where 7.0 server support currently exists. However if you wish to debug from an unenhanced standard Eclipse 3.5 EE IDE you must run through some hoops and export your EAR manually, deploy/update it in the admin console and attach to the debuggable process manually. In other application servers such as WebLogic, OC4J, Glassfish, Tomcat and even WebSphere 6.0 this process is handled automatically for you via an eclipse plugin.

Prerequisites

Install Eclipse EE

  • I installed a clean version of Eclipse Galileo 3.5 SR2 EE Edition (32-bit) (April 2010) on a Window 7 64-bit install where the default JRE was the 64-Bit server version of the SUN JVM. I therefore needed to override the default java.exe by specifying the following shortcut override
C:\eclipse35-32bit-home\eclipse.exe -vm c:/jdk1.6.0_32-bit/bin/java.exe
  • Default eclipse.ini settings must be modified as referenced.

Install a Database

  • We will be using a remote Oracle 11 instance as well as a local Derby 10.5.3.0 instance or the embedded Derby instance that comes with WebSphere.

Install WebSphere 7.0

  • I installed the commercial 7.0.0.0 version of IBM WebSphere 7 and then the 7.0.0.5 fixpack in 7.0.0-WS-WAS-WinX32-FP0000005.pak using the 7.0.0.5-WS-UPDI-WinIA32.zip installer.
  • Ibm websphere fixpack 7001 result.JPG

Install WebSphere Eclipse 3.4 Server Plugin - unusable

We will first see if the WebSphere 6.0 or 6.1 plugin works with WebSphere 7.0 - it fails on missing jar files that are not present in 7.0. The WebSphere 6.1 Eclipse WTP server plugin is not shipped by default with Eclipse (WebSphere 6.0 for JEE 1.4 is).

  • Note: The WebSphere 6.1 plugin for Eclipse WTP is currently being developed - see the following Eclipse WTP enhancement request 160220 in progress.
  • We are not blocked from using Eclipse WTP to manage the WebSphere 6.1 server, but without this plugin we will need to attach manually to port 7781 of a running WebSphere server that was started in debug mode outside of the Eclipse IDE - we will use this alternate debug approach.
  • If you try to stub out the 73 jars required by the WebSphere 6.0 plugin to make it work with a WebSphere 7.0 server - you will get the following exception starting WebSphere from Eclipse. - so don't do it
com.ibm.ws.exception.ConfigurationError: java.lang.Exception: Cannot find BundleContext for service com.ibm.ws.runtime.config.ConfigServiceImpl
 at com.ibm.ws.runtime.WsServerImpl.bootConfigService(WsServerImpl.java:335)
 at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:171)

WebSphere Configuration Changes

JNDI Datasource Setup

Global Scoped Datasource Setup

  • We will for now use the already configured JNDI name "DefaultDatasource".
  • Note the check box "Use this data source in container managed persistence (CMP)" that allows us to use this TX datasource for all our container managed deployments below.

DefaultDatasource derby on websphere7.JPG

Downloading EclipseLink Libraries

Download EclipseLink using HTTP - recommended

Download EclipseLink using Maven

See the repository on http://www.eclipse.org/eclipselink/downloads/index.php

Download EclipseLink using SVN - developers only

Container Managed and Application Managed Scenarios

  • The steps below detail what needs to be done to migrate an existing JPA enterprise application to use a JPA provider other than the shipped OpenJPA - like the org.eclipse.persistence.jpa.PersistenceProvider provider.
  • The following table summarizes the type of test, server modifications and results for verious container managed and application managed EntityManager deployments on the IBM WebSphere 7 server.
UC# DI# Test Example-Description Container-Managed vs Application-Managed Injected-EMF vs Persistence bootstrap JTA, non-JTA, RESOURCE _LOCAL Datasource Entities, PU in utility JAR Entities, PU in EJB JAR Entities, PU in WAR WAS console parent-last Classloader override Server modifications? persistence.xml 2.0 XSD Schema Weaving entities Runs JPA2 Impl (shipped with EclipseLink 1.2 only) Runs JPA2 Impl (shipped with EclipseLink 2.0 only) - IE: CriteriaBuilder
#1 Container-Managed PU in EAR(EJB,WAR) - working with server mod container injected @PersistenceContext EM on SLSB JTA (derby XA) PU in EJB n/c eclipselink.jar in %server%/lib 1.0 only Weaved as 1.0  ?  ?
#2 Container-Managed PU in EAR(EJB,WAR) - with eclipselink.jar in EAR container injected @PersistenceContext EM on SLSB JTA (derby XA network 10.5.3.0) PU in EJB n/c none 1.0 only Weaved as 1.0  ?  ?
#3 Application-Managed PU in EAR(WAR) - working with no server mods application injected @PersistenceUnit on Servlet RESOURCE_LOCAL (derby network XA) PU in WAR n/c eclipselink.jar, JPA persistence jar in EAR 1.0 only Weaved as 1.0  ?  ?

Configuration

  • This section is currently undergoing review and minor editing as more deployment scenarios are tested today (20100419)
  • The following section details investigations on what configurations work when using the EclipseLink JPA provider on the IBM WebSphere 7 Application Server. The test deployments are configured around container managed EARs that require server modification such as creating a global shared library or placing the eclipselink.jar library directly in the %SERVER%/lib, and application managed EARs that do not require any server modification as they ship the required libraries as part of the EAR.

EAR Source

Publishing the EAR

  • On WebSphere we use the standard stop|update|start commands on the Applications | Application Types | WebSphere enterprise applications' console page in our case accessed via http://xps435:9060/ibm/console/login.do

Container Managed

EAR configuration

  • standard @EJB statless session bean injected on Servlet client, the EJB bean is @PersistenceContext injected with a container managed EntityManager using a transactional datasource (in this case derby)
  • Server startup logs
WebSphere Platform 7.0.0.5 [BASE 7.0.0.5 cf050926.18] running with process name beowulf5Node01Cell\beowulf5Node01\server1 and process id 2928
Host Operating System is Windows XP, version 5.1 build 2600 Service Pack 3
Java version = 1.6.0, Java Compiler = j9jit24, Java VM name = IBM J9 VM

EclipseLink library as Global Shared Library

  • Here a developer with access to the servers' console would add a global scope library that references an external eclipselink.jar.
  • This works the same as the option below.

EclipseLink library in Server/lib

  • Placing the eclipselink.jar library directly on the server in the %SERVER%/lib directory and restarting the server will allow container managed deployments of EclipseLink applications following the JPA 1.0 specification to inject and function correctly.

Predeploy, deploy and runtime logs

[4/16/10 10:26:39:484 EDT] 0000000a SystemOut O [EL Finest]: 2010-04-16 10:26:39.343--ServerSession(112920251)--Thread(Thread[server.startup : 1,5,main])--Begin predeploying Persistence Unit example; session jar:file:/C:/opt/was7001/AppServer/profiles/AppSrv01/installedApps/beowulf5Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Initial; factoryCount 0
[4/16/10 10:26:40:218 EDT] 0000000a SystemOut O [EL Finer]: 2010-04-16 10:26:40.218--ServerSession(112920251)--Thread(Thread[server.startup : 1,5,main])--Class [org.eclipse.persistence.example.jpa.server.business.Cell] registered to be processed by weaver.
[4/16/10 10:26:40:312 EDT] 0000000a SystemOut O [EL Finest]: 2010-04-16 10:26:40.312--ServerSession(1551588475)--Thread(Thread[server.startup : 1,5,main])--End predeploying Persistence Unit exampleAM; session jar:file:/C:/opt/was7001/AppServer/profiles/AppSrv01/installedApps/beowulf5Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_exampleAM; state Predeployed; factoryCount 1
[4/16/10 10:26:44:078 EDT] 0000000a EJBContainerI I WSVR0057I: EJB jar started: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar
[4/16/10 10:27:23:781 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:23.781--ServerSession(112920251)--Thread(Thread[WebContainer : 1,5,main])--Begin weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/16/10 10:27:23:843 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:23.843--ServerSession(112920251)--Thread(Thread[WebContainer : 1,5,main])--Weaved persistence (PersistenceEntity) [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/16/10 10:27:23:843 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:23.843--ServerSession(112920251)--Thread(Thread[WebContainer : 1,5,main])--Weaved fetch groups (FetchGroupTracker) [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/16/10 10:27:23:843 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:23.843--ServerSession(112920251)--Thread(Thread[WebContainer : 1,5,main])--End weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/16/10 10:27:26:953 EDT] 00000012 SystemOut O [EL Config]: 2010-04-16 10:27:26.953--ServerSession(112920251)--Connection(292491631)--Thread(Thread[WebContainer : 1,5,main])--Connected: jdbc:derby:C:\opt\was7001\AppServer\profiles\AppSrv01/installedApps/beowulf5Node01Cell/DefaultApplication.ear/DefaultDB
[4/16/10 10:27:27:312 EDT] 00000012 SystemOut O [EL Finest]: 2010-04-16 10:27:27.312--UnitOfWork(67175425)--Thread(Thread[WebContainer : 1,5,main])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@562176386( id: null state: null left: null right: null parent: HashSet@562700682 references: HashSet@562700682).
[4/16/10 10:27:27:359 EDT] 00000012 SystemOut O [EL Fine]: 2010-04-16 10:27:27.359--ClientSession(488447261)--Connection(18219286)--Thread(Thread[WebContainer : 1,5,main])--INSERT INTO EL_CELL (STATE, TSEQ, ACELLATTRIBUTE_ID, RIGHT_ID) VALUES (?, ?, ?, ?)

Container Managed EclipseLink library in EAR

  • This is an interesting use case where the eclipselink JPA library is included locally in the EAR (requiring no server modifications) but the persistence unit itself is container managed by @PersistenceContext EntityManager Proxy injection on a stateless session bean.
  • The following EAR attachment for bug# 309201 can be used as source until this project is checked into SVN.
  • Note: eclipselink.jar must be readded to the EAR in the position of EAR/APP-INF/lib/eclipselink.jar

Injected EntityManager on the SSB

  • We get a JPATxEntityManager@14001400 entityManager instance injected from the WebSphere container - this looks like a proxy wrapper for our EntityManagerImpl. - Normally I would debug this to verify but I am having difficulty attaching to port 7777 using my own instructions for WebSphere 6.1
[4/19/10 12:07:22:106 EDT] 00000028 SystemOut O [EL Example]: enterprise: ApplicationService query: select object(e) from Cell e on 
EM: JPATxEntityManager@14001400[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example,
 org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]

Insertion/Persist Testing

  • The following screen captures highlight our results of doing entity insertion on this custom container managed persistence unit detailed below.
  • after a read/ReadAllQuery of 5 existing entities and insertion/Persist of an additional 5...

Browser cap jpa1 persistenceContext injected em on slsb jta derby.JPG

  • inserting another 5 in a 2nd transaction using a different injected entityManager but the same JPAtxEntityManager proxy.

Browser cap jpa1 persistenceContext injected em on slsb jta derby after 2nd insert.JPG

Configuration

Console Overrides
  • None - I did not override the Class Loader Order - it is still set to Classes loaded with parent class loader first.
EclipseLink library in EAR
  • org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR
    • EarContent
      • APP-INF
        • lib
          • eclipselink.jar - note there is no eclipselink.jar on the server.
MANIFEST.MF
  • Place the following path to the included eclipselink.jar in your ejb.jar(s) ejbModule/META-INF/MANIFEST.MF file. This is the recommended approach where you update the manifest that is at the root of where your entities are - in this case as part of the ejb.jar.
  • In my example application, there are 3 MANIFEST.MF files, one on the WAR, one on the ejb.jar and one on the EAR.
    • EAR/META-INF/MANIFEST.MF
    • EJB/ejbModule/META-INF/MANIFEST.MF - update this one to point to the eclipselink.jar in the EAR/APP-INF/lib directory.
    • WAR/WebContent/META-INF/MANIFEST.MF
  • As a recommended test I removed all 3 manifest entries below and received an expected Injection failure - putting the ejb.jar(s) manifest back to reference eclipselink.jar allowed us to successully inject an EclipseLink JPA provider EntityManagerImpl instance instead of the default OpenJPA provider's instance.
Manifest-Version: 1.0
Class-Path: APP-INF/lib/eclipselink.jar
  • Eclipse can be used to format your manifest file by selecting the eclipselink and other dependency libraries in the EJB project properties dialog

Eclipse ejb container managed project manifest classpath to eclipselink jar in ear .JPG

Stateless Session Bean
@Local
@Stateless
public class ApplicationService implements ApplicationServiceLocal {
 @PersistenceContext(unitName="example", type=PersistenceContextType.TRANSACTION) 
 private EntityManager entityManager;
...
 // with no transaction or entityManager application management - all callbacks handled by the container
 public boolean insertObjects(List<Cell> classes) {
...
 entityManager.persist(classes.get(i));
Servlet client
public class FrontController extends HttpServlet implements Servlet {
 @EJB(beanName="ApplicationService")
 public ApplicationServiceLocal applicationService;
persistence.xml in ejb.jar
  • Note: you will need a populated schema - the best way to do this is to enable the ddl-generation properties in your persistence.xml - however for Derby (on WebSphere) and Oracle (in general because of implicit auto-commit for CM TX datasource) - I am able to only do this in a separate SE JPA app - see the generic DDL generation project in SVN that has the same enties and will create your schema and propopulate your Derby database for you. Normally this is not an issue since the schema should be created by the DBA anyway.
<persistence-unit name="example" transaction-type="JTA">
 <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
 <jta-data-source>derbyXA</jta-data-source> <!-- custom local TX 10.5.3.0 derby -->
 <class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
 <class>org.eclipse.persistence.example.jpa.server.business.CellAttribute</class> 
 <properties>
 <property name="eclipselink.target-server" value="WebSphere_7"/>
 <property name="eclipselink.target-database" value="Derby"/> 
 <property name="eclipselink.weaving" value="true"/> 
 <!--property name="eclipselink.ddl-generation" value="drop-and-create-tables"/-->
 <!--property name="eclipselink.ddl-generation.output-mode" value="database"/-->
 <property name="eclipselink.logging.level" value="FINEST"/>
 </properties> 
 </persistence-unit>

Logs

[4/19/10 12:56:51:468 EDT] 0000001a ApplicationMg A WSVR0204I: Application: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR Application build level: Unknown
[4/19/10 12:56:51:858 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 12:56:51.838--ServerSession(104924737)--Thread(Thread[WebContainer : 6,5,main])--Begin predeploying Persistence Unit example; session jar:file:/C:/opt/was7b/AppServer/profiles/AppSrv01/installedApps/xps435Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Initial; factoryCount 0
[4/19/10 12:56:52:448 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 12:56:52.448--ServerSession(104924737)--Thread(Thread[WebContainer : 6,5,main])--End predeploying Persistence Unit example; session jar:file:/C:/opt/was7b/AppServer/profiles/AppSrv01/installedApps/xps435Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Predeployed; factoryCount 1
[4/19/10 12:56:52:458 EDT] 0000001a EJBContainerI I WSVR0037I: Starting EJB jar: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar
[4/19/10 12:56:52:458 EDT] 0000001a EJBContainerI I CNTR0167I: The server is binding the org.eclipse.persistence.example.jpa.server.business.ApplicationServiceLocal interface of the ApplicationService enterprise bean in the org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar module of the org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR application. The binding location is: ejblocal:org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar/ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationServiceLocal
[4/19/10 12:56:52:478 EDT] 0000001a EJBContainerI I WSVR0057I: EJB jar started: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar
[4/19/10 12:56:52:488 EDT] 0000001a webapp I com.ibm.ws.webcontainer.webapp.WebGroupImpl WebGroup SRVE0169I: Loading Web Module: enterprise.
[4/19/10 12:56:52:508 EDT] 0000001a WASSessionCor I SessionContextRegistry getSessionContext SESN0176I: Will create a new session context for application key default_hostenterprise
[4/19/10 12:56:52:528 EDT] 0000001a webcontainer I com.ibm.ws.wswebcontainer.VirtualHost addWebApplication SRVE0250I: Web Module enterprise has been bound to default_host[*:9080,*:80,*:9443,*:5060,*:5061,*:443].
[4/19/10 12:56:52:528 EDT] 0000001a ApplicationMg A WSVR0221I: Application started: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR
[4/19/10 12:56:52:528 EDT] 0000001a CompositionUn A WSVR0191I: Composition unit WebSphere:cuname=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR in BLA WebSphere:blaname=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR started.
 
>action
http://127.0.0.1:9080/enterprise/FrontController?action=demo&rnd=.04393939419
[4/19/10 12:57:42:028 EDT] 00000019 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR] [/enterprise] [FrontController]: Initialization successful.
[4/19/10 12:57:42:028 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.028--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--Begin weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.078--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--Weaved persistence (PersistenceEntity) [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.078--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--Weaved fetch groups (FetchGroupTracker) [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.078--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--End weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService.insertObjects() em: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
[4/19/10 12:57:42:078 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService persisting: org.eclipse.persistence.example.jpa.server.business.Cell@1706321332( id: null state: null left: null right: null parent: HashSet@1706845628 references: HashSet@1706845628) on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
[4/19/10 12:57:42:088 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.078--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--Begin deploying Persistence Unit example; session jar:file:/C:/opt/was7b/AppServer/profiles/AppSrv01/installedApps/xps435Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Predeployed; factoryCount 1
[4/19/10 12:57:42:158 EDT] 00000019 SystemOut O [EL Info]: 2010-04-19 12:57:42.158--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--EclipseLink, version: Eclipse Persistence Services - 2.1.0.qualifier
[4/19/10 12:57:42:168 EDT] 00000019 SystemOut O [EL Config]: 2010-04-19 12:57:42.168--ServerSession(104924737)--Connection(1708484053)--Thread(Thread[WebContainer : 5,5,main])--connecting(DatabaseLogin(
 platform=>DerbyPlatform
 user name=> ""
 connector=>JNDIConnector datasource name=>null
))
[4/19/10 12:57:42:418 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.418--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--End deploying Persistence Unit example; session jar:file:/C:/opt/was7b/AppServer/profiles/AppSrv01/installedApps/xps435Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar!/_example; state Deployed; factoryCount 1
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.468--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--client acquired
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.468--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--TX binding to tx mgr, status=STATUS_ACTIVE
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.468--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@1706321332( id: null state: null left: null right: null parent: HashSet@1706845628 references: HashSet@1706845628).
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService persisting: org.eclipse.persistence.example.jpa.server.business.Cell@1706845628( id: null state: null left: null right: null parent: HashSet@826618180 references: HashSet@826618180) on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
[4/19/10 12:57:42:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.468--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--begin unit of work commit
[4/19/10 12:57:42:478 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.478--ClientSession(1595039506)--Thread(Thread[WebContainer : 5,5,main])--TX beginTransaction, status=STATUS_ACTIVE
[4/19/10 12:57:42:478 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.478--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--Execute query InsertObjectQuery(org.eclipse.persistence.example.jpa.server.business.Cell@1708418516( id: null state: null left: null right: null parent: HashSet@1707894220 references: HashSet@1707894220))
[4/19/10 12:57:42:488 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.488--ClientSession(1595039506)--Thread(Thread[WebContainer : 5,5,main])--reconnecting to external connection pool
[4/19/10 12:57:42:498 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:42.498--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--Execute query DataModifyQuery()
[4/19/10 12:57:42:508 EDT] 00000019 SystemOut O [EL Fine]: 2010-04-19 12:57:42.508--ClientSession(1595039506)--Connection(1358319862)--Thread(Thread[WebContainer : 5,5,main])--INSERT INTO EL_CELL_EL_CELL (references_ID, peers_ID) VALUES (?, ?)
 bind => [9, 6]
[4/19/10 12:57:42:528 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.528--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--TX afterCompletion callback, status=COMMITTED
[4/19/10 12:57:42:538 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:42.538--UnitOfWork(1076117540)--Thread(Thread[WebContainer : 5,5,main])--end unit of work commit
[4/19/10 12:57:42:538 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService query: select object(e) from Cell e on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
[4/19/10 12:57:43:008 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.008--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--client acquired
[4/19/10 12:57:43:018 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.018--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--TX binding to tx mgr, status=STATUS_ACTIVE
[4/19/10 12:57:43:018 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:43.018--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--Execute query ReadAllQuery(referenceClass=Cell sql="SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL")
[4/19/10 12:57:43:058 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:57:43.058--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--Register the existing object org.eclipse.persistence.example.jpa.server.business.Cell@1081950333( id: 2 state: null left: null right: null parent: HashSet@85329174 references: HashSet@85329174)
[4/19/10 12:57:43:078 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.078--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--TX beforeCompletion callback, status=STATUS_ACTIVE
[4/19/10 12:57:43:078 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.078--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--begin unit of work commit
[4/19/10 12:57:43:088 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.088--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--initialize identitymaps
[4/19/10 12:57:43:088 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.088--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--TX afterCompletion callback, status=COMMITTED
[4/19/10 12:57:43:088 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:57:43.088--UnitOfWork(393484148)--Thread(Thread[WebContainer : 5,5,main])--end unit of work commit
[4/19/10 12:57:43:088 EDT] 00000019 SystemOut O [EL Example]: enterprise: Object: org.eclipse.persistence.example.jpa.server.business.Cell@1366970746( id: 1 state: null left: null right: null parent: HashSet@-379786916 references: HashSet@-379786916)
 
 
>2nd insert
http://127.0.0.1:9080/enterprise/FrontController?action=demo&rnd=.04393939420
[4/19/10 12:58:37:468 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService.insertObjects() em: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
[4/19/10 12:58:37:468 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService persisting: org.eclipse.persistence.example.jpa.server.business.Cell@1281379424( id: null state: null left: null right: null parent: HashSet@1281903720 references: HashSet@1281903720) on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
[4/19/10 12:58:37:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:58:37.468--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--client acquired
[4/19/10 12:58:37:468 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:58:37.468--UnitOfWork(1285901477)--Thread(Thread[WebContainer : 5,5,main])--TX binding to tx mgr, status=STATUS_ACTIVE
[4/19/10 12:58:37:478 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:58:37.468--UnitOfWork(1285901477)--Thread(Thread[WebContainer : 5,5,main])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@1281379424( id: null state: null left: null right: null parent: HashSet@1281903720 references: HashSet@1281903720).
[4/19/10 12:58:37:478 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService persisting: org.eclipse.persistence.example.jpa.server.business.Cell@1281903720( id: null state: null left: null right: null parent: HashSet@-448207544 references: HashSet@-448207544) on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Example]: enterprise: ApplicationService query: select object(e) from Cell e on EM: JPATxEntityManager@6acf6acf[PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example, org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#ApplicationService#org.eclipse.persistence.example.jpa.server.business.ApplicationService/entityManager]
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:58:37.608--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--client acquired
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finer]: 2010-04-19 12:58:37.608--UnitOfWork(374150733)--Thread(Thread[WebContainer : 5,5,main])--TX binding to tx mgr, status=STATUS_ACTIVE
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:58:37.608--UnitOfWork(374150733)--Thread(Thread[WebContainer : 5,5,main])--Execute query ReadAllQuery(referenceClass=Cell sql="SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL")
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:58:37.608--ServerSession(104924737)--Thread(Thread[WebContainer : 5,5,main])--reconnecting to external connection pool
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Fine]: 2010-04-19 12:58:37.608--ServerSession(104924737)--Connection(57672560)--Thread(Thread[WebContainer : 5,5,main])--SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL
[4/19/10 12:58:37:608 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 12:58:37.608--UnitOfWork(374150733)--Thread(Thread[WebContainer : 5,5,main])--Register the existing object org.eclipse.persistence.example.jpa.server.business.Cell@1081950333( id: 2 state: null left: null right: null parent: HashSet@85329174 references: HashSet@85329174)

No EclipseLink library on the Server or the EAR

  • This is not a valid configuration because the EclipseLink JPA provider library is needs to be added either on the server or via the APP-LIB directory of the EAR for Container or Application managed scenarios.
  • You will see the following exception if you attempt to use the org.eclipse.persistence.jpa.PersistenceProvider in this case. This forms a good base case failure test upon which the other valid scenarios can be verified against.
    • javax.ejb.EJBException: Injection failure; nested exception is: java.lang.IllegalStateException: EntityManagerFactory has not been created for PU : PuId=org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR#org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEJB.jar#example

Application Managed

  • The primary use case that requires an appplication managed entityManager is one where the application developer does not have access to the server to create global or local scope Shared Libraries. In this case all library configuration and classloader scope changes must be done inside the EAR itself.
  • For either the developer that has access to the deployment workflow on the WAS console - We can modify the classloader to load the parent last using the following procedure from DeveloperWorks.
  • See Enterprise Applications > org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR > Class loader in...

Was console modify application classloader parent last.JPG

EAR configuration

  • standard Persistence static bootstrap EMF on the servlet or @PersistenceUnit injection on the servlet with a non-JTA datasource or direct JDBC connection (in this case derby)

Eclipselink library in EAR

Static Persistence bootstrap EMF creation in WAR Servlet

Static Persistence bootstrap EMF creation in EJB Session Bean

  • 20100420: this scenario may actually work if the MANIFEST.MF points to the correct APP-INF/lib/eclipselink.jar - I just need time to revert the testing EAR and verify this.
  • placing the eclipselink.jar in the EAR and attempting to use the SE Persistence bootstrap class to create an EMF on a Stateless Session Bean - in the EJB.jar - (on the EJB container instead of the WEB container) does not work because the classloader position of the eclipselink.jar is not visible to the JPA 1.0 persistence library that ships with the server higher up.
  • You see the following warnings
[4/16/10 11:23:09:218 EDT] 0000001d SystemErr R WARNING: Unable to load persistence provider "org.eclipse.persistence.jpa.PersistenceProvider" due to "java.lang.ClassNotFoundException: org.eclipse.persistence.jpa.PersistenceProvider"
[4/16/10 11:23:09:218 EDT] 0000001d SystemErr R WARNING: Found unrecognized persistence provider "org.eclipse.persistence.jpa.PersistenceProvider" in place of OpenJPA provider. This provider's properties will not be used.
  • You will get a null EntityManagerFactory when attempting
EntityManagerFactory emf = Persistence.createEntityManagerFactory("example");

@PersistenceUnit EMF injection on WAR Servlet

  • This is the recommended application managed way of getting an EMF.
JPA 1.0 persistence.xml
  • Both Persistence boostrap and @PersistenceUnit injection work well on an application managed EclipseLink JPA 1.0 client like a servlet in the WAR in an EAR on WebSphere 7.0.
WebContent/META-INF/MANIFEST.MF
  • Manifest entry on the WAR must reference the libraries in the EAR project
    • Class-Path: APP-INF/lib/eclipselink.jar
      • APP-INF/lib/javax.persistence_2.0.0.v201002051058.jar
Servlet client
  • Injection of EMF on servlet
public class FrontController extends HttpServlet implements Servlet {
 @PersistenceUnit(unitName="example-am1")
 private EntityManagerFactory emf;
Persistence.xml 1.0 version
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<!-- persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0"-->
 <persistence-unit name="example-am1" transaction-type="JTA">
 <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
 <!-- shared-cache-mode>NONE</shared-cache-mode--> <!-- JPA 2.0 PFD only -->
 <jta-data-source>DefaultDatasource</jta-data-source>
 <class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
 <class>org.eclipse.persistence.example.jpa.server.business.CellAttribute</class>
 <properties>
 <property name="eclipselink.target-server" value="WebSphere_7"/>
 <property name="eclipselink.logging.level" value="FINEST"/>
 </properties> 
 </persistence-unit>
</persistence>
  • Or the RESOURCE_LOCAL version
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
 <persistence-unit name="example-am1" transaction-type="RESOURCE_LOCAL"> 
 <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
 <class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
 <class>org.eclipse.persistence.example.jpa.server.business.CellAttribute</class>
 <properties>
 <property name="eclipselink.target-server" value="WebSphere_7"/>
 <property name="eclipselink.weaving" value="true"/> 
 <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
 <property name="eclipselink.target-database" value="Derby"/> 
 <property name="javax.persistence.jdbc.url" value="jdbc:derby://127.0.0.1:1527/websphere;create=true"/>
 <property name="javax.persistence.jdbc.user" value="APP"/>
 <property name="javax.persistence.jdbc.password" value="APP"/>
 <!--property name="eclipselink.ddl-generation" value="drop-and-create-tables"/-->
 <!--property name="eclipselink.ddl-generation.output-mode" value="database"/-->
 <property name="eclipselink.logging.level" value="FINEST"/>
 </properties> 
 </persistence-unit>
</persistence>
Console logs
  • The following logs show evidence of Weaving (bytecode instrumentation for change tracking and cache performance), EntityManagerFactory and EntityManager EclipseLink JPA provider instances and their usage.
[4/16/10 16:21:55:359 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-16 16:21:55.359--ServerSession(439228974)--Thread(Thread[WebContainer : 4,5,main])--Begin predeploying Persistence Unit example-am1; session file:/C:/opt/was7001/AppServer/profiles/AppSrv01/installedApps/beowulf5Node01Cell/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.websphere.EnterpriseWeb.war/_example-am1; state Initial; factoryCount 0
 
[4/16/10 16:23:51:640 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:51.64--ServerSession(1268927394)--Thread(Thread[WebContainer : 7,5,main])--Begin weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/16/10 16:23:51:718 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:51.718--ServerSession(1268927394)--Thread(Thread[WebContainer : 7,5,main])--Weaved persistence (PersistenceEntity) [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/16/10 16:23:51:718 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:51.718--ServerSession(1268927394)--Thread(Thread[WebContainer : 7,5,main])--Weaved fetch groups (FetchGroupTracker) [org.eclipse.persistence.example.jpa.server.business.Cell].
[4/16/10 16:23:53:515 EDT] 0000001d SystemOut O Injected @PersistenceUnit: org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl@5dc85dc8
[4/16/10 17:03:28:312 EDT] 00000019 SystemOut O EntityManager from Injected @PersistenceUnit: org.eclipse.persistence.internal.jpa.EntityManagerImpl@4cfc4cfc
[4/16/10 16:23:53:421 EDT] 0000001d SystemOut O [EL Finer]: 2010-04-16 16:23:53.421--ServerSession(439228974)--Thread(Thread[WebContainer : 7,5,main])--Canonical Metamodel class [org.eclipse.persistence.example.jpa.server.business.Cell_] not found during initialization.
[4/16/10 16:23:53:500 EDT] 0000001d SystemOut O [EL Finer]: 2010-04-16 16:23:53.5--ServerSession(439228974)--Thread(Thread[WebContainer : 7,5,main])--client acquired
[4/16/10 16:23:53:515 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:53.515--UnitOfWork(758525238)--Thread(Thread[WebContainer : 7,5,main])--PERSIST operation called on: org.eclipse.persistence.example.jpa.server.business.Cell@165349851( id: null state: null left: null right: null parent: HashSet@165874147 references: HashSet@165874147).
[4/16/10 16:23:53:859 EDT] 0000001d SystemOut O [EL Finest]: 2010-04-16 16:23:53.859--UnitOfWork(859058996)--Thread(Thread[WebContainer : 7,5,main])--Execute query ReadAllQuery(referenceClass=Cell sql="SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL")
...
[4/19/10 9:33:35:213 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 09:33:35.213--ServerSession(1893232856)--Thread(Thread[WebContainer : 6,5,main])--Execute query ReadObjectQuery(name="left" referenceClass=Cell sql="SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL WHERE (RIGHT_ID = ?)")
[4/19/10 9:33:35:213 EDT] 0000001a SystemOut O [EL Fine]: 2010-04-19 09:33:35.213--ServerSession(1893232856)--Connection(1950839879)--Thread(Thread[WebContainer : 6,5,main])--SELECT ID, STATE, TSEQ, RIGHT_ID, ACELLATTRIBUTE_ID FROM EL_CELL WHERE (RIGHT_ID = ?)
 bind => [1]
[4/19/10 9:33:35:243 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 09:33:35.243--ServerSession(1893232856)--Thread(Thread[WebContainer : 6,5,main])--Execute query ReadAllQuery(name="references" referenceClass=Cell sql="SELECT t1.ID, t1.STATE, t1.TSEQ, t1.RIGHT_ID, t1.ACELLATTRIBUTE_ID FROM EL_CELL_EL_CELL t0, EL_CELL t1 WHERE ((t0.peers_ID = ?) AND (t1.ID = t0.references_ID))")
[4/19/10 9:33:35:243 EDT] 0000001a SystemOut O [EL Fine]: 2010-04-19 09:33:35.243--ServerSession(1893232856)--Connection(1950839879)--Thread(Thread[WebContainer : 6,5,main])--SELECT t1.ID, t1.STATE, t1.TSEQ, t1.RIGHT_ID, t1.ACELLATTRIBUTE_ID FROM EL_CELL_EL_CELL t0, EL_CELL t1 WHERE ((t0.peers_ID = ?) AND (t1.ID = t0.references_ID))
 bind => [1]
[4/19/10 9:33:35:293 EDT] 0000001a SystemOut O [EL Finest]: 2010-04-19 09:33:35.293--UnitOfWork(273879123)--Thread(Thread[WebContainer : 6,5,main])--Register the existing object org.eclipse.persistence.example.jpa.server.business.Cell@579084932( id: 4 state: null left: null right: null parent: HashSet@1550867568 references: HashSet@1550867568)
Browser Output
  • The following screen capture illustrates the fact that 5 entities were read from in this case a Derby 10.5.3.0 database using a RESOURCE_LOCAL @PersistenceUnit injected Application Managed EMF on a Servlet client as part of the WAR in an EAR that contains the eclipselink.jar library embedded - essentially an SE application.

Browser cap jpa1 persistenceUnit injected emf resource local.JPG

  • After insertion of 5 new entities...
Browser cap jpa1 persistenceUnit injected emf resource local After insert.JPG
[4/19/10 11:06:40:990 EDT] 00000019 SystemOut O [EL Finest]: 2010-04-19 11:06:40.99--UnitOfWork(1284721811)--Thread(Thread[WebContainer : 5,5,main])--Execute query DataModifyQuery(sql="INSERT INTO EL_CELL_EL_CELL (references_ID, peers_ID) VALUES (?, ?)")
[4/19/10 11:06:40:990 EDT] 00000019 SystemOut O [EL Fine]: 2010-04-19 11:06:40.99--ClientSession(1751476325)--Connection(593306461)--Thread(Thread[WebContainer : 5,5,main])--INSERT INTO EL_CELL_EL_CELL (references_ID, peers_ID) VALUES (?, ?)
 bind => [10, 7]
JPA 2.0 persistence.xml
  • Application Managed EAR's that define a JPA 2.0 schema reference in their persistence.xml will not deploy.
 <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0">
  • The following XML parsing error occurs on the server.
[4/16/10 15:45:50:093 EDT] 00000016 SystemErr R com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.metadata.MetaDataException: CWWJP0040E: The persistence.xml in application org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR, module org.eclipse.persistence.example.jpa.server.websphere.EnterpriseWeb.war, has a syntax error at line number: 20, column number: 209.
[4/16/10 15:45:50:093 EDT] 00000016 SystemErr R at com.ibm.ws.jpa.management.JPAApplInfo.processModulePUs(JPAApplInfo.java:185)
[4/16/10 15:45:49:250 EDT] 00000016 JPAPxmlInfo E CWWJP0040E: Incorrect syntax or error detected in the persistence.xml file in application: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR, module: org.eclipse.persistence.example.jpa.server.websphere.EnterpriseWeb.war, at line number: 20, column number: 209. The following associated error message occurred: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'persistence' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.]
 at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:326)
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'persistence' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
 at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
App managed jpa2 ear fails to deploy on websphere 7.JPG
  • Also, if we try using JPA 2.0 API via a persistence.xml that is defined as JPA 1.0 so it passed deployment - we will still get an expected runtime exception when we try to use JPA 2.0 commands.
[4/16/10 16:08:47:578 EDT] 0000001b servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet FrontController in application org.eclipse.persistence.example.jpa.server.websphere.EnterpriseEAR. Exception created : java.lang.NoSuchMethodError: javax/persistence/EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
 at org.eclipse.persistence.example.jpa.server.business.ApplicationManagedService.getMetamodel(ApplicationManagedService.java:139)

Persistence JAR location

  • Where does the standard library plugins/com.ibm.ws.jpa.jar and runtimes/com.ibm.ws.jpa.thinclient_7.0.0.jar fit in? Is this a JPA spec jar or an OpenJPA implementation?

JDBC JAR location

  • If you are using a JDBC provider other than the 3 provided by WebSphere, you must defined all of the JDBC Providers, the Data sources and the secondary JAAS-J2C authentication data sections in the admin console for your new datasource.

Was console oracle datasource1.JPG

Remote Debugging EclipseLink in WebSphere 7.0 from Eclipse 3.4

The following procedure details how to attach to a debug version of IBM WebSphere 7.0 with the Eclipse 3.4 IDE.

Note: we will not be modifying startServer.bat. The java process in that script is only for server startup - if you need to debug this part of the server.

Modify console setup to start server in debug mode

  • Login to the console using your admin login or a default username like system
  • Navigate to Servers | Server Types | WebSphere Application servers | server1
  • Navigate on the right down to Additional Properties | Debugging service
  • Enable JDWP by ckecking the checkbox Enable service at server startup"
    • The default properties below will be OK unmodified
      • JVM debug port = 7781
      • JVM debug arguments = -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7781
  • Optionally you can add server packages if you have the source for WebSphere
  • We will be debugging client test code and EclipseLink API in the Eclipse IDE

Websphere7 console debug screen.JPG

Start the WebSphere Server

Either run bin/startServer.bat or the following server ant test target in our suite.

<trunk>jpa\eclipselink.jpa.test>ant server-start

Attach Eclipse 3.4 to the debug port on WebSphere 7

  • Right-click your test code
  • Debug as | Debug Configurations
  • select Remote Java Application
  • create a new config by hitting the top-left new launch configuration icon
  • type a name for your config and modify only the port to read 7781
  • apply changes
  • click debug

Eclipse34 remote debug websphere7 screen.JPG

You should see the a stack trace ready for any breakpoints in your code that are hit - or suspend an orb thread to break into the code.


Deploy and Run EAR application

Depending on your breakpoints you will see a stacktrace hit in the Eclipse IDE similar to the following.

VirtualAttributeTestSuite [Remote Java Application]	
	IBM J9 VM[localhost:7781]	
		Thread [P=833989:O=0:CT] (Running)	
		Daemon Thread [Signal Dispatcher] (Running)	
...
		Daemon Thread [Thread-52] (Running)	
		Daemon Thread [ORB.thread.pool : 0] (Running)	
		Daemon Thread [ORB.thread.pool : 1] (Suspended (breakpoint at line 302 in ConcurrencyManager))	
			ConcurrencyManager.isAcquired() line: 302	
			ClientSession(AbstractSession).isInTransaction() line: 2405	
			ClientSession(AbstractSession).beginTransaction() line: 538	
			SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(Sequence, AbstractSession) line: 455	
			SequencingManager.getNextValue(AbstractSession, Class) line: 905	
			ClientSessionSequencing.getNextValue(Class) line: 70	
			ObjectBuilder.assignSequenceNumber(Object, AbstractSession) line: 277	
			RepeatableWriteUnitOfWork(UnitOfWorkImpl).assignSequenceNumber(Object, ClassDescriptor) line: 402	
			RepeatableWriteUnitOfWork(UnitOfWorkImpl).registerNotRegisteredNewObjectForPersist(Object, ClassDescriptor) line: 3952	
			RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(Object, ClassDescriptor) line: 359	
			RepeatableWriteUnitOfWork(UnitOfWorkImpl).registerNewObjectForPersist(Object, Map) line: 3899	
			EntityManagerImpl.persist(Object) line: 254	
			JPATxEmInvocation(JPAExEmInvocation).persist(Object) line: 336	
			JPATxEntityManager(JPAEntityManager).persist(Object) line: 123	
			VirtualAttributeTestSuite.testInsertVirtualAttribute() line: 63	
			NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
			NativeMethodAccessorImpl.invoke(Object, Object[]) line: 45	
			DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 37	
			Method.invoke(Object, Object...) line: 599	
			VirtualAttributeTestSuite(TestCase).runTest() line: 154	
			VirtualAttributeTestSuite(TestCase).runBare() line: 127	
			VirtualAttributeTestSuite(JUnitTestCase).runBareServer() line: 391	
			TestRunnerBean.runTest(String, String, Properties) line: 87	
			EJSRemote0SLTestRunner_ed643271.runTest(String, String, Properties) line: not available	
			_EJSRemote0SLTestRunner_ed643271_Tie.runTest(InputStream, ResponseHandler) line: not available	
			_EJSRemote0SLTestRunner_ed643271_Tie._invoke(String, InputStream, ResponseHandler) line: not available	
			WSExtendedServerDelegate(ServerDelegate).dispatchInvokeHandler(InterceptorManager, ServerRequestInfoImpl, String, Object, ServerRequestReader) line: 622	
			WSExtendedServerDelegate(ServerDelegate).dispatch(ServerRequest) line: 475	
			ORB(ORB).process(ServerRequest) line: 504	
			ORB.process(ServerRequest) line: 1571	
			Connection.respondTo(RequestHandler, IIOPReader) line: 2771	
			Connection.doWork(RequestHandler, IIOPReader) line: 2640	
			WorkUnitImpl.doWork() line: 63	
			PooledThread.run() line: 118	
			ThreadPool$Worker.run() line: 1527	
		Daemon Thread [AIO Timer Thread 1] (Running)	
		Daemon Thread [WebContainer : 0] (Running)	
...
 	        Daemon Thread [RT=7:P=833989:O=0:WSTCPTransportConnection[addr=10.156.52.98,port=1553,local=9104]] (Running)	

References

Bugs

History

  • 20090115: Originated on build EclipseLink 1.1 M6 - Michael O'Brien
  • 20100415: Updating for eclipselink.jar placement for container managed and application managed scenarios in EclipseLink enhancement # 309201

Back to the top