Skip to main content
Jump to: navigation, search

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

m (EclipseLink JPA Deployed on IBM WebSphere CE 2.1 using Eclipse WTP)
m (Replacing page with '=EclipseLink JPA Deployed on IBM WebSphere CE 2.1 using Eclipse WTP=')
Line 1: Line 1:
=EclipseLink JPA Deployed on IBM WebSphere CE 2.1 using Eclipse WTP=
=EclipseLink JPA Deployed on IBM WebSphere CE 2.1 using Eclipse WTP=
<font color="red">Note: This tutorial' is under construction for the next week as of 20080918.</font>
If you want to get a small web application running quickly on WebSphere CE - 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 Community Edition] 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] (June 2008 +) with all 5 packages (DTP 1.6, EMF 2.4, GEF 3.4, WTP 3.0, XSD 2.4), [ Derby Database 10.4], Java JDK 1.6.0_04 - Note 1.5.0_14 comes with the server, [ IBM WebSphere CE]
This example will run fine with any Database that EclipseLink supports.
===<font color="green">Install Eclipse EE</font>===
*I installed a clean version of Eclipse Ganymede (June 2008) with all of WTP 3.0
===<font color="green">Install a Database</font>===
*In this example I am using the embedded [ Derby 10.4], the table schemas have already been created manually and all entity java classes may be generated using the Eclipse [ DALI] tool.
*There is also an express version of [ IBM DB2 Express C 9.5] available
===<font color="green">Install WebSphere CE</font>===
I installed the latest [ IBM WebSphere CE build (Sept 2008)] and followed the instructions on that page.
===Install WebSphere CE Eclipse 3.4 Server Plugin===
The WebSphere CE server plugin is not shipped by default with Eclipse - you will need to update your Eclipse IDE to pick up the [ WebSphere CE Eclipse plugin].
*I selected to download the zip, and treat is a a local update site in eclipse
===Validating the WebSphereCE/Eclipse configuration===
*Follow the [ quickstart] guide on the IBM website.
*In the servers view select ''New | Server''
*Use the '''IBM|IBM WASCE v2.1 Server''' plugin when creating a server
*Note: WebSphere CE 2.1 is only certified in Java SE 1.5 (However JDK 1.6 runtime support is available) - You may use a SUN 1.6 JRE and continue
*Start the server to test the plugin
**You should see the following messages when running on either a 1.5 or 1.6 JRE.
Booting Geronimo Kernel (in Java 1.5.0_14)...
Startup completed in 54.065s seconds
Booting Geronimo Kernel (in Java 1.6.0_04)...
Startup completed in 29.424s seconds
==WebSphere CE Configuration Changes==
WebSphere CE configuration modifications can be done on the admin console using the login system:manager
Currently working past a deployment blocking issue where both '''Run on Server''' from the Eclipse IDE or a drop of the EAR/WAR into the '''deploy''' directory has failed on both a 1.5 and 1.6 JRE.
===Run on Server fails with NPE===
!ENTRY org.eclipse.wst.server.core 4 0 2008-09-18 14:07:35.432
!MESSAGE Could not publish to the server.
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(
at org.eclipse.wst.server.core.internal.Server.publishImpl(
at org.eclipse.wst.server.core.internal.Server$
===WAR dropped into deploy directory===
13:36:21,972 WARN  [TomcatModuleBuilder] Web application . does not contain a WEB-INF/geronimo-web.xml deployment plan.  This may or may not be a problem, depending on whether you have things like resource references that need to be resolved.  You can also give the deployer a separate deployment plan file on the command line.
==JNDI Datasource Setup==
===Global Scoped Datasource Setup===
==Persistence JAR location==
==EclipseLink JAR location==
==JDBC JAR location==
==Create J2EE application==
The WebSphere CE server is defined as generic '''"WebSphere"'''
*JTA : Put persistence.xml beside your JPA entities in ''yourProjectEJB/ejbModule/META-INF'' 
<source lang="xml">
<persistence version="1.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
  <persistence-unit name="unified" transaction-type="JTA">
      <property name="" value="WebSphere"/>
      <property name="eclipselink.logging.level" value="FINEST"/>
      <property name="eclipselink.session-name" value="eclipselinkwls"/>
*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">
  <persistence-unit name="stat.create.tables" transaction-type="RESOURCE_LOCAL">
      <property name="eclipselink.jdbc.platform" value="oracle.toplink.platform.database.DerbyPlatform"/>
      <property name="eclipselink.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
      <property name="" value="Derby"/>           
      <property name="eclipselink.jdbc.url" value="jdbc:derby:C:/opt/derby104/unified;create=true"/>
      <property name="eclipselink.jdbc.user" value="APP"/>
      <property name="eclipselink.jdbc.password" value="APP"/>
      <property name="eclipselink.logging.level" value="FINEST"/>           
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
      <property name="eclipselink.ddl-generation.output-mode" value="database"/>
==Start Server==
==Publish EAR==
==Perform CRUD operations: JPQL insert and query==
===Browser Output===
*See [[EclipseLink/UserGuide/Developing_JPA_Projects_%28ELUG%29|Developing JPA Projects]] in the EclipseLink User's Guide.
*[ Download IBM WebSphere CE]
*[ Download IBM DB2 Express Database]
*[ IBM WebSphere CE Documentation]
*[ IBM WebSphere CE Eclipse Plugin]
*[ IBM WebSphere CE edition archive]
Originated on build 20080916 - Michael O'Brien

Revision as of 17:22, 24 March 2009

EclipseLink JPA Deployed on IBM WebSphere CE 2.1 using Eclipse WTP

Back to the top