users@glassfish.java.net

Not working at all: JEE 6 tutorial on GlassFish v3

From: <glassfish_at_javadesktop.org>
Date: Thu, 23 Jul 2009 08:58:05 PDT

This really frustrates me. After trying many things in the last 4 days I must conclude that the JEE 6 tutorial does NOT work on GlassFish v3. I thought I could start get familiar with GlassFish v3 and JEE 6 since it will be released in the next couple of months (September?). But looking at the latest (and not greatest) Preview I must put GlassFish v3 and JEE6 aside (unfortunately).

But maybe it is just that I am the only developer who is using Windows XP and Eclipse 3.5/Galileo?

Just for the ones who tries to reproduce that or gets in the same

I did the following:

1. Install Java SE and JDK Update 14 (jdk-6u14-windows-i586.exe)
Here the JDK does normally installs JavaDB by default. Since GlassFish ships it as well and I do not know whether their is some interference I did not install JavaDB.

2. Install GlassFish and Java EE 6 SDK Preview
Link: http://java.sun.com/javaee/downloads/preview/
Do NOT use the Prelude installation or the promoted Preview builds from the glassfish site. The reason is that the update tool does neither find the Ant add-on nor the JEE6 Tutorial plugin.

3. Install Ant and JEE Tutorial
As described here: http://java.sun.com/javaee/6/docs/tutorial/doc/
Ant: http://java.sun.com/javaee/6/docs/tutorial/doc/gexaj.html#gexaa
Tutorial: http://java.sun.com/javaee/6/docs/tutorial/doc/gexaj.html#gexba

3. Manual configurations and settings
See here: glassfishv3\glassfish\docs\javaee-tutorial\examples\bp-project\docs\DeveloperREADME.html
The readme seems not up to date since it still refers to JEE5 and do the following:
- set the Path (System variable under Windows>My Computer>Advanced>Environment variables) for: JAVA_HOME, JAVA_HOME\bin, ANT_HOME and ANT_HOME\bin
- also set the glassfish/bin to the path
NOTE: there is a subdirectory under glassfishv3 called glassfish. I assume this is the one to be used. Example path (installed under e:\glassfishv3):

C:\Program Files\Java\jdk1.6.0_14;C:\Program Files\Java\jdk1.6.0_14\bin;E:\glassfishv3\ant;E:\glassfishv3\ant\bin;E:\glassfishv3\glassfish\bin;E:\glassfishv3\bin;%SystemRoot%\system32

Following the readme the build.properties needs to be changed in glassfishv3\glassfish\docs\javaee-tutorial\examples\bp-project.

Here I have only set change two properties:
javaee.home=E:/glassfishv3/glassfish
javaee.tutorial.home=E:/glassfishv3/glassfish/docs/javaee-tutorial

The readme outlines to edit javaee.server.username, javaee.server.passwordfile and javaee.adminserver.port. But since I have installed it using the anonymous admin user I think it is okay to leave it like this:
javaee.server.username=admin
# AS_ADMIN_PASSWORD=adminadmin
#
# Notice that the password is adminadmin since this is
# the default password used by GlassFish.
#
javaee.server.passwordfile=${javaee.tutorial.home}/examples/common/admin-password.txt

Next install Eclipse 3.5 / Galileo
1. Go to Help>Install New Software
2. Add Site "https://ajax.dev.java.net/eclipse/"
3. Select GlassFish Java EE 5 and Java EE 6 support
4. Install and restart Eclipse
5. Jump to the Servers-View and add a new Server:
6. Select GlassFish v3 Java EE6 (though there is also the GlassFish v3 Prelude??)

Create a Java Project "bookstore"
1. Create project
2. copy the source from the tutorial that workspace/bookstore from here: glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore\src
3. Fix compile errors by adding the JEE6 library
- project>properties>java build path>libraries
- add library>server runtime>next>GlassFish v3 Java EE 6
- now put the compile classes into a jar since this is needed for the next project

Create a "Dynamic Web Project" "bookstore1"
1. Create Project
2. Delete the index.html and copy to the WebContent folder using this: E:\glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore1\web
3. Copy the source folder from: E:\glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore1\src
4. Copy the bookstore.jar (created based on the other project) to WebContent/WEB-INF/lib

Now create the example database
Before you can do that you got to fix some things:
1. Go to E:\glassfishv3\glassfish\docs\javaee-tutorial\examples\common\sql\javadb
2. Edit tutorial.sql
3. Remove the following line:
-- For Persistence order example
INSERT INTO EJB_ORDER_SEQUENCE_GENERATOR
    VALUES ('VENDOR_PART_ID',1);

The reason is that this table does not exist. Another possibility is to copy the tutorial.sql from JEE 5 tutorial (but I am not sure whether it will work for the examples on JEE 6).

Instructions from: http://java.sun.com/javaee/6/docs/tutorial/doc/bnaez.html
1. Open the command prompt and jump to: E:\glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore1
2. Start the database: asadmin start-database
3. Start ant create-tables
The documentations points out that the console will log this line:
[sql] 181 of 181 SQL statements executed successfully
But since the tutorial.sql is incomplete there will be only 171 lines and not 181 (correct for JEE 5).
4. Create the JDBC data source. See: http://java.sun.com/javaee/6/docs/tutorial/doc/bnaez.html#bnafb


Now start Eclipse and in there start GlassFish
1. Deploy bookstore1
2. And open in the browser the link: http://localhost:8080/bookstore1/bookstore

Now it should work but it doesn't :-(. All you get is:

HTTP Status 404 - Servlet BookStoreServlet is not available
type Status report
message Servlet BookStoreServlet is not available
description The requested resource (Servlet BookStoreServlet is not available) is not available.

The serverlog (in the eclipse console) states:
INFO: Started bundle org.glassfish.deployment.javaee-core [64]
INFO: DOL Loading time313
INFO: Started bundle org.glassfish.security.websecurity [194]
INFO: Unknown loader org.glassfish.internal.api.DelegatingClassLoader_at_1f2a9da class org.glassfish.internal.api.DelegatingClassLoader
INFO: Started bundle org.glassfish.orb.connector [157]
INFO: Started bundle org.glassfish.orb.iiop [158]

INFO: Couldn't create bookstore database bean: Unable to retrieve EntityManagerFactory for unitName null
INFO: Loading application bookstore1 at /bookstore1
INFO: Loading bookstore1 Application done is 2000 ms
INFO: GlassFish v3 startup time : Felix(1906ms) startup services(2516ms) total(4422ms)
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
INFO: felix.fileinstall.poll (ms) 5000
INFO: felix.fileinstall.dir E:\glassfishv3\glassfish\domains\domain1\autodeploy-bundles
INFO: felix.fileinstall.debug 1
INFO: felix.fileinstall.bundles.new.start true

INFO: PWC1412: WebModule[/bookstore1] ServletContext.log():PWC1409: Marking servlet BookStoreServlet as unavailable

Maybe somebody makes more progress than I. It is really sad because I was really excited about getting involved into JEE 6 and GlassFish and contribute something to the community as I did for many other Open Source projects. But in this case I need to raise my white flag :-(.

Tai
[Message sent by forum member 'taitruong' (taitruong)]

http://forums.java.net/jive/thread.jspa?messageID=357254