Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
EclipseLink/Examples/JPA/WebSphere7 Web Tutorial
Contents
- 1 EclipseLink JPA Deployed on IBM WebSphere 7 using Eclipse WTP
- 1.1 Development Environment
- 1.2 Prerequisites
- 1.3 WebSphere Configuration Changes
- 1.4 JNDI Datasource Setup
- 1.5 Persistence JAR location
- 1.6 EclipseLink JAR location
- 1.7 JDBC JAR location
- 1.8 Create J2EE application
- 1.9 Persistence.xml
- 1.10 Publish EAR
- 1.11 Perform CRUD operations: JPQL insert and query
- 1.12 Remote Debugging of WebSphere 7.0 in Eclipse 3.4
- 1.13 References
EclipseLink JPA Deployed on IBM WebSphere 7 using Eclipse WTP
Note: This tutorial' is under construction for the next week as of 20090115.
If you want to get a small web application running quickly on WebSphere 7.0 - the services provided by the Web Tools Project plugin 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 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 was used to generate Entities from a schema with sequences already populated.
Development Environment
Software: Eclipse IDE for Java EE 3.4 Ganymede SR 1 (Oct 2008 +) IBM J9 JRE 1.6.0 build 2.4 20080816_22093.
Prerequisites
Install Eclipse EE
- I installed a clean version of Eclipse Ganymede 3.4 EE Edition (Oct 2008)
Install a Database
Install WebSphere 7.0
I installed the commercial 7.0.0.1 version
Install WebSphere Eclipse 3.4 Server Plugin
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.
WebSphere Configuration Changes
JNDI Datasource Setup
Global Scoped Datasource Setup
Persistence JAR location
EclipseLink JAR location
JDBC JAR location
Create J2EE application
Persistence.xml
Publish EAR
Validating the WebSphere/EclipseLink configuration
Without eclipselink.jar reference
With eclipselink.jar reference
Perform CRUD operations: JPQL insert and query
Browser Output
Remote Debugging of WebSphere 7.0 in 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
- The default properties below will be OK unmodified
- 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
References
- See 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
Originated on build 20090115 - EclipseLink 1.1 M6 - Michael O'Brien