Jump to: navigation, search

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

m (Install GlassFish)
m (EclipseLink JPA Deployed on GlassFish 3 using Eclipse WTP)
Line 24: Line 24:
 
====<font color="green">Install GlassFish</font>====
 
====<font color="green">Install GlassFish</font>====
 
*Do not use V3 TP2 - use the [http://download.java.net/glassfish/v3/promoted/ V3 Prelude release] instead.
 
*Do not use V3 TP2 - use the [http://download.java.net/glassfish/v3/promoted/ V3 Prelude release] instead.
*See the following quickly solved issues posted to the GlassFish forum
+
*The following issues were quickly solved within a 24h timeframe when posted to the [http://forums.java.net/jive/forum.jspa?forumID=56&start=0 GlassFish Forum]
  
 
[http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 GF3tp2 domain1 fails to start out of the box - JDK 1.7 collision and no proxy set]
 
[http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 GF3tp2 domain1 fails to start out of the box - JDK 1.7 collision and no proxy set]
Line 31: Line 31:
  
  
*See the following [https://glassfish.dev.java.net/downloads/v3-techPreview-2.html GlassFish Technology Preview 2 page].
+
*It is recommended that you install the GlassFish V3 Prelude version and use the latest 1.0.9+ V3 SNAPSHOT Eclipse 3.4 Server plugin to run/debug the prelude server.  Do not use the Ve Tech Preview 2 install.See the following [https://glassfish.dev.java.net/downloads/v3-techPreview-2.html GlassFish Technology Preview 2 page].
*Note V3TP2 is currently a [http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3TP2Content subset of JEE5] but it has everything we need JSF 1.2, JSP 2.1/Servlet 2.5 and JPA 1.0 via EclipseLink
+
*Note V3Prelude is currently a [http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3TP2Content subset of JEE5] but it has everything we need JSF 1.2, JSP 2.1/Servlet 2.5 and JPA 1.0 via EclipseLink
  
  
*Using GlassFish V3 TP2 install - the jars are named 10.0-tp-2-SNAPSHOT - but the plugin expects 10.0-SNAPSHOT
+
*Using the GlassFish V3 Prelude install - we select the SNAPSHOT version of the plugin after using "Download Additional Server Adapters" to get a 1.0.9 GlassFish plugin or later.
  
[[Image:New_server_jar_version_errors.JPG]]
+
[[Image:Glassfish_prelude_new_server_use_snapshot.JPG]]
 
+
*Using GlassFish V3 Prelude install - we run into jar naming conflicts - solved below.
+
 
+
[[Image:Glassfish_prelude_new_server_jar_version_errors.JPG]]
+
 
+
*However, A workaround is to use the snapshot plugin which matches with the jar names in Prelude except for a missing javax.management.j2ee-10.0-SNAPSHOT.jar which you can stub, get from another server or create from the tp2 javax.javaee-10.0-tp-2-SNAPSHOT.jar
+
 
+
[[Image:Glassfish_prelude_new_server_javax_mgmt_missing.JPG]]
+
  
  
 
All of deployment, JNDI setup, persistence.xml configuration, jpql query example - in progress ......
 
All of deployment, JNDI setup, persistence.xml configuration, jpql query example - in progress ......

Revision as of 10:33, 12 September 2008

EclipseLink JPA Deployed on GlassFish 3 using Eclipse WTP

Note: This tutorial' is under construction for the next week as of 20080909.


If you want to get a small web application running quickly on GlassFish - 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 needed to run EclipseLink inside GlassFish 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 M5 Ganymede (Feb 2008) with all 5 packages (DTP 1.6, EMF 2.4, GEF 3.4, WTP 3.0, XSD 2.4), Oracle 11g DB 11.1.0.6.0, Java JDK 1.5.0_11, GlassFish 3.0 TP2

This example will run fine with Eclipse 3.3 EE and any Database that EclipseLink supports.

Prerequisites

Install Eclipse EE

  • I installed a clean version of Eclipse Ganymede M5 with all of WTP 3.0

Install a Database

  • In this example I am using Oracle 11g, the table schemas have already been created manually and all entitity java classes have been generated using the Eclipse DALI tool.

Install GlassFish

http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 GF3tp2 domain1 fails to start out of the box - JDK 1.7 collision and no proxy set

http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 GlassFish V3 SNAPSHOT Server Plugin for Eclipse 3.4 jar problems with TP2 - use the Prelude Plugin


  • It is recommended that you install the GlassFish V3 Prelude version and use the latest 1.0.9+ V3 SNAPSHOT Eclipse 3.4 Server plugin to run/debug the prelude server. Do not use the Ve Tech Preview 2 install.See the following GlassFish Technology Preview 2 page.
  • Note V3Prelude is currently a subset of JEE5 but it has everything we need JSF 1.2, JSP 2.1/Servlet 2.5 and JPA 1.0 via EclipseLink


  • Using the GlassFish V3 Prelude install - we select the SNAPSHOT version of the plugin after using "Download Additional Server Adapters" to get a 1.0.9 GlassFish plugin or later.

Glassfish prelude new server use snapshot.JPG


All of deployment, JNDI setup, persistence.xml configuration, jpql query example - in progress ......