Skip to main content

Not working at all: JEE 6 tutorial on GlassFish v3

22 replies [Last post]
taitruong
Offline
Joined: 2009-07-19

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 problem 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. So 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@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

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hellofadude
Offline
Joined: 2009-08-05

I had this same problem with Glassfish v3 and changing javaeehome value in build file as well as setting up a datasource on server and voila! works fine..

taitruong
Offline
Joined: 2009-07-19

Yes! It is working now. I have misconfigured build.properties and javadb.properties in glassfishv3\glassfish\docs\javaee-tutorial\examples\bp-project:

In build.properties the javaee.home needs to be set to glassfishv3 and not to glassfishv3/glassfish:
javaee.home=E:/glassfishv3
javaee.tutorial.home=E:/glassfishv3/glassfish/docs/javaee-tutorial

So here only those 2 properties needs to be changed. I have undo my changes in javadb.properties and rolled back to its original file:
db.create.src=${javaee.tutorial.home}/examples/common/sql/${db.vendor}/tutorial.sql
db.delete.src=${javaee.tutorial.home}/examples/common/sql/${db.vendor}/delete.sql

What it is wrong though is that the delete.sql and tutorial.sql in JEE6 is incomplete! I have just copied it from JEE5 tutorial.

But if you are too lazy too download it here is the delete.sql:
===============================================
-- Delete the tutorial database tables
ALTER TABLE EJB_ORDER_PART DROP CONSTRAINT FK_1;
ALTER TABLE EJB_ORDER_VENDOR_PART DROP CONSTRAINT FK_2;
ALTER TABLE EJB_ORDER_VENDOR_PART DROP CONSTRAINT FK_3;
ALTER TABLE EJB_ORDER_LINEITEM DROP CONSTRAINT FK_4;
ALTER TABLE EJB_ORDER_LINEITEM DROP CONSTRAINT FK_5;

ALTER TABLE BANK_TX DROP CONSTRAINT fk_tx_account_id;
ALTER TABLE BANK_CUSTOMER_ACCOUNT_XREF DROP CONSTRAINT fk_bank_customer_id;
ALTER TABLE BANK_CUSTOMER_ACCOUNT_XREF DROP CONSTRAINT fk_bank_account_id;
ALTER TABLE BANK_ACCOUNT DROP CONSTRAINT pk_account;
ALTER TABLE BANK_CUSTOMER DROP CONSTRAINT pk_customer;
ALTER TABLE BANK_TX DROP CONSTRAINT pk_tx;

DROP TABLE WEB_BOOKSTORE_BOOKS;

DROP TABLE EJB_ORDER_LINEITEM;
DROP TABLE EJB_ORDER_ORDER;
DROP TABLE EJB_ORDER_VENDOR_PART;
DROP TABLE EJB_ORDER_VENDOR;
DROP TABLE EJB_ORDER_PART_DETAIL;
DROP TABLE EJB_ORDER_PART;
DROP TABLE EJB_ORDER_SEQUENCE_GENERATOR;

DROP TABLE BANK_SEQUENCE_GENERATOR;
DROP TABLE BANK_CUSTOMER_ACCOUNT_XREF;
DROP TABLE BANK_TX;
DROP TABLE BANK_CUSTOMER;
DROP TABLE BANK_ACCOUNT;
===============================================
The tutorial.sql is:
===============================================
-- Create tables for all Java EE Tutorial examples

-- Create tables for Web bookstore applications

CREATE TABLE WEB_BOOKSTORE_BOOKS
(bookId VARCHAR(8),
surname VARCHAR(24),
firstName VARCHAR(24),
title VARCHAR(96),
price FLOAT,
onSale SMALLINT,
calendar_year INT,
description VARCHAR(30),
inventory INT);

INSERT INTO WEB_BOOKSTORE_BOOKS VALUES('201', 'Duke', '',
'My Early Years: Growing up on *7',
30.75, 0, 1995, 'What a cool book.', 20);

INSERT INTO WEB_BOOKSTORE_BOOKS VALUES('202', 'Jeeves', '',
'Web Servers for Fun and Profit', 40.75, 1,
2000, 'What a cool book.', 20);

INSERT INTO WEB_BOOKSTORE_BOOKS VALUES('203', 'Masterson', 'Webster',
'Web Components for Web Developers',
27.75, 0, 2000, 'What a cool book.', 20);

INSERT INTO WEB_BOOKSTORE_BOOKS VALUES('205', 'Novation', 'Kevin',
'From Oak to Java: The Revolution of a Language',
10.75, 1, 1998, 'What a cool book.', 20);

INSERT INTO WEB_BOOKSTORE_BOOKS VALUES('206', 'Gosling', 'James',
'Java Intermediate Bytecodes', 30.95, 1,
2000, 'What a cool book.', 20);

INSERT INTO WEB_BOOKSTORE_BOOKS VALUES('207', 'Thrilled', 'Ben',
'The Green Project: Programming for Consumer Devices',
30.00, 1, 1998, 'What a cool book', 20);

INSERT INTO WEB_BOOKSTORE_BOOKS VALUES('208', 'Tru', 'Itzal',
'Duke: A Biography of the Java Evangelist',
45.00, 0, 2001, 'What a cool book.', 20);

-- Create tables for Order application (examples/ejb/order)

-- Self-reference to identify Bill of Material (BOM)
-- Compound PK

CREATE TABLE EJB_ORDER_PART (
PARTNUMBER VARCHAR(15) NOT NULL,
REVISION NUMERIC(2) NOT NULL,
DESCRIPTION VARCHAR(255),
REVISIONDATE TIMESTAMP NOT NULL,
BOMPARTNUMBER VARCHAR(15),
BOMREVISION NUMERIC(2) ,
PRIMARY KEY (PARTNUMBER, REVISION)
);

ALTER TABLE EJB_ORDER_PART
add CONSTRAINT FK_1 FOREIGN KEY (BOMPARTNUMBER, BOMREVISION)
REFERENCES EJB_ORDER_PART (PARTNUMBER, REVISION);

-- Bean will be mapped to 2 tables (PART and PART_DETAIL)
-- BLOB column type
-- CLOB column type

CREATE TABLE EJB_ORDER_PART_DETAIL (
PARTNUMBER VARCHAR(15) NOT NULL,
REVISION NUMERIC(2) NOT NULL,
SPECIFICATION CLOB(10K),
DRAWING BLOB(10K),
PRIMARY KEY (PARTNUMBER, REVISION)
);

-- PK can be mapped to a primitive PK field type

CREATE TABLE EJB_ORDER_VENDOR (
VENDORID INTEGER PRIMARY KEY,
VENDORNAME VARCHAR(30) NOT NULL,
ADDRESS VARCHAR(255) NOT NULL,
CONTACT VARCHAR(255) NOT NULL,
PHONE VARCHAR(30) NOT NULL
);

-- Can be used for unknown PK
-- 1-1 map to PART
-- Compound FK

CREATE TABLE EJB_ORDER_VENDOR_PART (
VENDORPARTNUMBER BIGINT PRIMARY KEY,
DESCRIPTION VARCHAR(255),
PRICE DOUBLE PRECISION NOT NULL,
VENDORID INTEGER NOT NULL,
PARTNUMBER VARCHAR(15) NOT NULL,
PARTREVISION NUMERIC(2) NOT NULL,
CONSTRAINT FK_2 FOREIGN KEY (VENDORID) REFERENCES EJB_ORDER_VENDOR (VENDORID),
CONSTRAINT FK_3 FOREIGN KEY (PARTNUMBER, PARTREVISION) REFERENCES EJB_ORDER_PART (PARTNUMBER, REVISION),
UNIQUE (PARTNUMBER, PARTREVISION)
);

CREATE TABLE EJB_ORDER_SEQUENCE_GENERATOR (
GEN_KEY VARCHAR(255),
GEN_VALUE NUMERIC(20)
);

CREATE TABLE EJB_ORDER_ORDER (
ORDERID INTEGER PRIMARY KEY,
STATUS CHAR(1) NOT NULL,
LASTUPDATE TIMESTAMP NOT NULL,
DISCOUNT NUMERIC(2) NOT NULL,
SHIPMENTINFO VARCHAR(255)
);

-- Overlapping PK-FK
-- Uni-directional to EJB_ORDER_VENDOR_PART

CREATE TABLE EJB_ORDER_LINEITEM (
ORDERID INTEGER NOT NULL,
ITEMID NUMERIC(3) NOT NULL,
QUANTITY NUMERIC(3) NOT NULL,
VENDORPARTNUMBER BIGINT NOT NULL,
CONSTRAINT FK_4 FOREIGN KEY (ORDERID) REFERENCES EJB_ORDER_ORDER (ORDERID),
CONSTRAINT FK_5 FOREIGN KEY (VENDORPARTNUMBER) REFERENCES EJB_ORDER_VENDOR_PART (VENDORPARTNUMBER),
PRIMARY KEY (ORDERID, ITEMID)
);

-- Create tables for online banking application (Duke's Bank)

CREATE TABLE BANK_SEQUENCE_GENERATOR (
GEN_KEY VARCHAR(255),
GEN_VALUE NUMERIC(20)
);

CREATE TABLE BANK_ACCOUNT (
ACCOUNT_ID NUMERIC(20) CONSTRAINT PK_ACCOUNT PRIMARY KEY,
TYPE VARCHAR(24),
DESCRIPTION VARCHAR(30),
BALANCE NUMERIC(10,2),
CREDIT_LINE NUMERIC(10,2),
BEGIN_BALANCE NUMERIC(10,2),
BEGIN_BALANCE_TIME_STAMP TIMESTAMP);

CREATE TABLE BANK_CUSTOMER (
CUSTOMER_ID NUMERIC(20) CONSTRAINT PK_CUSTOMER PRIMARY KEY,
LAST_NAME VARCHAR(30),
FIRST_NAME VARCHAR(30),
MIDDLE_INITIAL VARCHAR(1),
STREET VARCHAR(40),
CITY VARCHAR(40),
STATE VARCHAR(2),
ZIP VARCHAR(5),
PHONE VARCHAR(16),
EMAIL VARCHAR(30));

CREATE TABLE BANK_TX (
TX_ID NUMERIC(20) CONSTRAINT PK_TX PRIMARY KEY,
ACCOUNT_ID NUMERIC(20),
TIME_STAMP TIMESTAMP,
AMOUNT NUMERIC(10,2),
BALANCE NUMERIC(10,2),
DESCRIPTION VARCHAR(30),
CONSTRAINT FK_TX_ACCOUNT_ID FOREIGN KEY (ACCOUNT_ID) REFERENCES BANK_ACCOUNT(ACCOUNT_ID));

CREATE TABLE BANK_CUSTOMER_ACCOUNT_XREF (
CUSTOMER_ID NUMERIC(20),
ACCOUNT_ID NUMERIC(20),
CONSTRAINT FK_BANK_CUSTOMER_ID FOREIGN KEY (CUSTOMER_ID) REFERENCES BANK_CUSTOMER(CUSTOMER_ID),
CONSTRAINT FK_BANK_ACCOUNT_ID FOREIGN KEY (ACCOUNT_ID) REFERENCES BANK_ACCOUNT(ACCOUNT_ID));

-- For Persistence order example
INSERT INTO EJB_ORDER_SEQUENCE_GENERATOR
VALUES ('VENDOR_PART_ID',1);

-- Duke's bank

INSERT INTO BANK_SEQUENCE_GENERATOR
VALUES ('CUSTOMER_ID',203);

INSERT INTO BANK_SEQUENCE_GENERATOR
VALUES ('ACCOUNT_ID',5050);

INSERT INTO BANK_SEQUENCE_GENERATOR
VALUES ('TX_ID',100);

INSERT INTO BANK_ACCOUNT VALUES
(5005, 'Money Market', 'Hi Balance', 4000.00, 0.00, 3500.00, '2005-07-28 23:03:20');

INSERT INTO BANK_ACCOUNT VALUES
(5006, 'Checking', 'Checking', 85.00, 0.00, 66.54, '2005-07-21 03:12:00');

INSERT INTO BANK_ACCOUNT VALUES
(5007, 'Credit', 'Visa', 599.18, 5000.00, 166.08, '2005-07-23 10:13:54');

INSERT INTO BANK_ACCOUNT VALUES
(5008, 'Savings', 'Super Interest Account', 55601.35, 0.00, 5433.89, '2005-07-15 12:55:33');

INSERT INTO BANK_CUSTOMER VALUES
(200, 'Jones', 'Richard', 'K',
'88 Poplar Ave.', 'Cupertino', 'CA', '95014',
'408-123-4567', 'rhill@j2ee.com');

INSERT INTO BANK_CUSTOMER VALUES
(201, 'Jones', 'Mary', 'R',
'88 Poplar Ave.', 'Cupertino', 'CA', '95014',
'408-123-4567', 'mhill@j2ee.com');

INSERT INTO BANK_CUSTOMER_ACCOUNT_XREF VALUES
(200, 5005);

INSERT INTO BANK_CUSTOMER_ACCOUNT_XREF VALUES
(201, 5005);

INSERT INTO BANK_CUSTOMER_ACCOUNT_XREF VALUES
(200, 5006);

INSERT INTO BANK_CUSTOMER_ACCOUNT_XREF VALUES
(200, 5007);

INSERT INTO BANK_CUSTOMER_ACCOUNT_XREF VALUES
(201, 5006);

INSERT INTO BANK_CUSTOMER_ACCOUNT_XREF VALUES
(201, 5007);

INSERT INTO BANK_CUSTOMER_ACCOUNT_XREF VALUES
(200, 5008);

INSERT INTO BANK_CUSTOMER_ACCOUNT_XREF VALUES
(201, 5008);

INSERT INTO BANK_TX VALUES
(1, 5005, '2005-9-01 12:55:33', 200.00, 4200.00, 'Refund');
UPDATE BANK_ACCOUNT SET BALANCE = 4200.00 WHERE ACCOUNT_ID = 5005;
INSERT INTO BANK_TX VALUES
(3, 5008, '2005-9-03 12:56:33', -1000.00, 54601.35, 'Transfer Out');
UPDATE BANK_ACCOUNT SET BALANCE = 54604.35 WHERE ACCOUNT_ID = 5008;
INSERT INTO BANK_TX VALUES
(4, 5006, '2005-9-03 12:57:33', 1000.00, 1085.00, 'Transfer In');
UPDATE BANK_ACCOUNT SET BALANCE = 1085.00 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(5, 5007, '2005-9-05 12:58:33', 33.00, 199.08, 'Clothing');
UPDATE BANK_ACCOUNT SET BALANCE = 199.08 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(6, 5006, '2005-9-06 12:59:33', 2000.00, 3085.00, 'Paycheck Deposit');
UPDATE BANK_ACCOUNT SET BALANCE = 3085.00 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(7, 5005, '2005-9-07 13:00:33', -200.00, 4000.00, 'ATM Withdrawal');
UPDATE BANK_ACCOUNT SET BALANCE = 3085.00 WHERE ACCOUNT_ID = 5005;
INSERT INTO BANK_TX VALUES
(8, 5006, '2005-9-08 13:01:33', -200.00, 2885.00, 'Car Insurance');
UPDATE BANK_ACCOUNT SET BALANCE = 2885.00 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(9, 5007, '2005-9-09 13:02:33', 186.00, 385.08, 'Car Repair');
UPDATE BANK_ACCOUNT SET BALANCE = 385.08 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(10, 5008, '2005-9-10 12:55:33', 1000.00, 55601.35, 'Deposit');
UPDATE BANK_ACCOUNT SET BALANCE = 55601.35 WHERE ACCOUNT_ID = 5008;
INSERT INTO BANK_TX VALUES
(11, 5007, '2005-9-11 12:55:33', 585.00, 970.08, 'Airplane Tickets');
UPDATE BANK_ACCOUNT SET BALANCE = 970.08 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(12, 5006, '2005-9-12 12:55:33', -675.00, 2210.00, 'Mortgage Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 2210.00 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(13, 5005, '2005-9-13 12:55:33', -100.00, 3900.00, 'ATM Withdrawal');
UPDATE BANK_ACCOUNT SET BALANCE = 3900.00 WHERE ACCOUNT_ID = 5005;
INSERT INTO BANK_TX VALUES
(14, 5006, '2005-9-14 12:55:33', -385.08, 1824.92, 'Visa Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 1824.92 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(15, 5007, '2005-9-15 12:55:33', -385.08, 585.00, 'Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 585.00 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(17, 5007, '2005-9-17 12:55:33', 26.95, 611.95, 'Movies');
UPDATE BANK_ACCOUNT SET BALANCE = 611.95 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(18, 5006, '2005-9-18 12:55:33', -31.00, 1793.92, 'Groceries');
UPDATE BANK_ACCOUNT SET BALANCE = 1793.92 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(19, 5005, '2005-9-19 12:55:33', -150.00, 3750.00, 'ATM Withdrawal');
UPDATE BANK_ACCOUNT SET BALANCE = 3750.00 WHERE ACCOUNT_ID = 5005;
INSERT INTO BANK_TX VALUES
(20, 5006, '2005-9-20 12:55:33', 2000.00, 3173.92, 'Paycheck Deposit');
UPDATE BANK_ACCOUNT SET BALANCE = 3173.92 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(21, 5007, '2005-9-21 12:55:33', 124.00, 735.95, 'Furnishings');
UPDATE BANK_ACCOUNT SET BALANCE = 735.95 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(23, 5007, '2005-9-23 12:55:33', 33.12, 769.07, 'Hardware');
UPDATE BANK_ACCOUNT SET BALANCE = 769.07 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(24, 5006, '2005-9-24 12:55:33', -175.33, 2998.59, 'Utility Bill');
UPDATE BANK_ACCOUNT SET BALANCE = 2998.59 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(25, 5006, '2005-9-25 12:55:33', -123.00, 2875.59, 'Groceries');
UPDATE BANK_ACCOUNT SET BALANCE = 2875.59 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(26, 5006, '2005-9-26 12:55:33', -675.00, 2200.59, 'Mortgage Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 2200.59 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(27, 5007, '2005-9-27 12:55:33', 24.72, 793.79, 'Cafe');
UPDATE BANK_ACCOUNT SET BALANCE = 793.79 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(28, 5008, '2005-9-28 12:55:33', 1000.00, 56601.35, 'Deposit');
UPDATE BANK_ACCOUNT SET BALANCE = 56601.35 WHERE ACCOUNT_ID = 5008;
INSERT INTO BANK_TX VALUES
(29, 5007, '2005-9-29 12:55:33', 35.00, 828.79, 'Hair Salon');
UPDATE BANK_ACCOUNT SET BALANCE = 828.79 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(30, 5006, '2005-9-30 12:55:33', -20.00, 2180.59, 'Gasoline');
UPDATE BANK_ACCOUNT SET BALANCE = 2180.59 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(31, 5005, '2005-10-01 12:55:33', -100.00, 3650.00, 'ATM Withdrawal');
UPDATE BANK_ACCOUNT SET BALANCE = 3650.00 WHERE ACCOUNT_ID = 5005;
INSERT INTO BANK_TX VALUES
(32, 5006, '2005-10-02 12:55:33', -56.87, 2123.72, 'Phone Bill');
UPDATE BANK_ACCOUNT SET BALANCE = 2123.72 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(33, 5007, '2005-10-03 12:55:33', 67.99, 896.78, 'Acme Shoes');
UPDATE BANK_ACCOUNT SET BALANCE = 896.78 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(35, 5007, '2005-10-05 12:55:33', 24.00, 920.78, 'Movies');
UPDATE BANK_ACCOUNT SET BALANCE = 920.78 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(36, 5006, '2005-10-06 12:55:33', 2000.00, 4123.72, 'Paycheck Deposit');
UPDATE BANK_ACCOUNT SET BALANCE = 4123.72 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(38, 5006, '2005-10-08 12:55:33', -100.00, 4023.72, 'Groceries');
UPDATE BANK_ACCOUNT SET BALANCE = 4023.72 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(39, 5007, '2005-10-09 12:55:33', 26.95, 947.73, 'Pizza');
UPDATE BANK_ACCOUNT SET BALANCE = 947.73 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(41, 5007, '2005-10-11 12:55:33', 125.00, 1072.73, 'Dentist');
UPDATE BANK_ACCOUNT SET BALANCE = 1072.73 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(42, 5006, '2005-10-12 12:55:33', -675.00, 3348.72, 'Mortgage Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 3348.72 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(43, 5005, '2005-10-13 12:55:33', -150.00, 3500.00, 'ATM Withdrawal');
UPDATE BANK_ACCOUNT SET BALANCE = 3500.00 WHERE ACCOUNT_ID = 5005;
INSERT INTO BANK_TX VALUES
(44, 5006, '2005-10-14 12:55:33', -947.73, 2400.99, 'Visa Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 2400.99 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(45, 5007, '2005-10-15 12:55:33', -947.73, 125.00, 'Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 125.00 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(47, 5007, '2005-10-17 12:55:33', 49.90, 100.85, 'Bookstore');
UPDATE BANK_ACCOUNT SET BALANCE = 100.85 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(48, 5006, '2005-10-18 12:55:33', -100.00, 2300.99, 'Groceries');
UPDATE BANK_ACCOUNT SET BALANCE = 2300.99 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(50, 5006, '2005-10-20 12:55:33', 2000.00, 4300.99, 'Paycheck Deposit');
UPDATE BANK_ACCOUNT SET BALANCE = 4300.99 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(51, 5007, '2005-10-21 12:55:33', 80.32, 181.17, 'Restaurant');
UPDATE BANK_ACCOUNT SET BALANCE = 181.17 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(53, 5007, '2005-10-23 12:55:33', 11.78, 192.95, 'Electronics');
UPDATE BANK_ACCOUNT SET BALANCE = 192.95 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(54, 5006, '2005-10-24 12:55:33', -150.45, 4150.54, 'Utility Bill');
UPDATE BANK_ACCOUNT SET BALANCE = 4150.54 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(55, 5005, '2005-10-25 12:55:33', -100.00, 3400.00, 'ATM Withdrawal');
UPDATE BANK_ACCOUNT SET BALANCE = 3400.00 WHERE ACCOUNT_ID = 5005;
INSERT INTO BANK_TX VALUES
(56, 5006, '2005-10-26 12:55:33', -675.00, 3475.54, 'Mortgage Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 3475.54 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(57, 5007, '2005-10-27 12:55:33', 24.00, 216.95, 'Ice Skating');
UPDATE BANK_ACCOUNT SET BALANCE = 216.95 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(58, 5006, '2005-10-28 12:55:33', -1000.00, 2475.54, 'Transfer Out');
UPDATE BANK_ACCOUNT SET BALANCE = 2475.54 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(59, 5008, '2005-10-28 12:55:33', 1000.00, 57601.35, 'Transfer In');
UPDATE BANK_ACCOUNT SET BALANCE = 57601.35 WHERE ACCOUNT_ID = 5008;
INSERT INTO BANK_TX VALUES
(60, 5006, '2005-11-02 12:55:33', -99.22, 3376.32, 'Phone Bill');
UPDATE BANK_ACCOUNT SET BALANCE = 3376.32 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(61, 5007, '2005-11-03 12:55:33', 29.97, 246.92, 'Toy Store');
UPDATE BANK_ACCOUNT SET BALANCE = 246.92 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(62, 5006, '2005-11-04 12:55:33', -2000.00, 376.32, 'Transfer Out');
UPDATE BANK_ACCOUNT SET BALANCE = 376.32 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(63, 5008, '2005-11-05 12:55:33', 2000.00, 59601.35, 'Transfer In');
UPDATE BANK_ACCOUNT SET BALANCE = 59601.35 WHERE ACCOUNT_ID = 5008;
INSERT INTO BANK_TX VALUES
(64, 5006, '2005-11-06 12:55:33', 2000.00, 2376.32, 'Paycheck Deposit');
UPDATE BANK_ACCOUNT SET BALANCE = 59601.35 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(65, 5007, '2005-11-07 12:55:33', 14.69, 261.61, 'Cafe');
UPDATE BANK_ACCOUNT SET BALANCE = 261.61 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(66, 5006, '2005-11-08 12:55:33', -108.99, 2267.33, 'Groceries');
UPDATE BANK_ACCOUNT SET BALANCE = 2267.33 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(67, 5006, '2005-11-09 12:55:33', -30.12, 2237.21, 'Gasoline');
UPDATE BANK_ACCOUNT SET BALANCE = 2237.21 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(69, 5007, '2005-11-11 12:55:33', 125.00, 386.61, 'Dentist');
UPDATE BANK_ACCOUNT SET BALANCE = 2237.21 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(70, 5006, '2005-11-12 12:55:33', -675.00, 1562.21, 'Mortgage Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 1562.21 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(72, 5006, '2005-11-13 12:55:33', -261.61, 1300.60, 'Visa Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 1300.60 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(73, 5007, '2005-11-14 12:55:33', -261.61, 125.00, 'Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 125.00 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(75, 5007, '2005-11-15 12:55:33', 24.00, 149.00, 'Drug Store');
UPDATE BANK_ACCOUNT SET BALANCE = 149.00 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(76, 5006, '2006-03-16 12:55:33', -67.98, 1232.62, 'Groceries');
UPDATE BANK_ACCOUNT SET BALANCE = 1232.62 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(78, 5006, '2006-03-17 12:55:33', 2000.00, 3232.62, 'Paycheck Deposit');
UPDATE BANK_ACCOUNT SET BALANCE = 3232.62 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(79, 5007, '2006-03-18 12:55:33', 32.95, 181.95, 'CDs');
UPDATE BANK_ACCOUNT SET BALANCE = 181.95 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(81, 5007, '2006-04-01 12:55:33', 14.10, 196.05, 'Sports Store');
UPDATE BANK_ACCOUNT SET BALANCE = 196.05 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(82, 5006, '2006-04-01 12:55:33', -99.30, 3133.32, 'Utility Bill');
UPDATE BANK_ACCOUNT SET BALANCE = 3133.32 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(84, 5006, '2006-04-04 12:55:33', -675.00, 2458.32, 'Mortgage Payment');
UPDATE BANK_ACCOUNT SET BALANCE = 2458.32 WHERE ACCOUNT_ID = 5006;
INSERT INTO BANK_TX VALUES
(85, 5007, '2006-04-10 12:55:33', 23.98, 220.03, 'Garden Supply');
UPDATE BANK_ACCOUNT SET BALANCE = 220.03 WHERE ACCOUNT_ID = 5007;
INSERT INTO BANK_TX VALUES
(86, 5005, '2006-04-19 12:55:33', -100.00, 3300.00, 'ATM Withdrawal');
UPDATE BANK_ACCOUNT SET BALANCE = 3300.00 WHERE ACCOUNT_ID = 5005;
===============================================

I don't know why I did the last error (book 203 can't be found). So assumed the database was corrupt. So I did "ant create-tables" again. This executes the deletion of the table and then recreates the example db including the data for the books.

After that everthing is working!

Thanks Marina for pointing to the right direction!

Tai

hellofadude
Offline
Joined: 2009-08-05

Had similar problem with glassfish 3. setting javaee home property as you described and setting a data source on the server seemed to solve problem for me!

Marina Vatkina

glassfish@javadesktop.org wrote:
> Okay. I found the problem. I have manually created the bookstore.jar without adding the src/META-INF/persistence.xml
>
> The easiest way is using Ant to create the jar files like:
> 1. Open the command prompt
> 2. go to glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore1>
> 3. Enter "ant"
> 4. copy the bookstore.jar to the eclipse project "bookstore1" from glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore\dist
> 5. Start Glassfish in Eclipse
> 6. Deploy bookstore1
> 7. Open the link http://localhost:8080/bookstore1/bookstore
>
> Now I get this:
> Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20090424-r4050): org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'WEB_BOOKSTORE_BOOKS' does not exist.
> Error Code: -1
> Call: SELECT BOOKID, ONSALE, TITLE, PRICE, INVENTORY, DESCRIPTION, CALENDAR_YEAR, SURNAME, FIRSTNAME FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
> bind => [203]
> Query: ReadObjectQuery(referenceClass=Book sql="SELECT BOOKID, ONSALE, TITLE, PRICE, INVENTORY, DESCRIPTION, CALENDAR_YEAR, SURNAME, FIRSTNAME FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)")
>
> Before I have properly started "ant create-tables" and all 181 SQLs (tutorial.sql copied from the JEE5 since in JEE6 it is incomplete) has been executed.
>
> @Marina
> In the post http://forums.java.net/jive/thread.jspa?messageID=356461&tstart=0
> you have mentioned:
> "...to change the persistence.xml to set the EclipseLink property:
> "eclipselink.ddl-generation" either to "drop-and-create-tables" or to
> "create-tables".
>
> If the steps included loading DDL, you missed that step.
>
> The latest V3 builds have support for automatic table creation requested via
> asadmin deploy command options."
>
> So this is not necessary to change anymore or should I change the persitence.xml?

It might be that "ant create-tables" creates tables not in the same database as
the persitence.xml points to...

Regards,
-marina

>
> Tai
> [Message sent by forum member 'taitruong' (taitruong)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357327
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

taitruong
Offline
Joined: 2009-07-19

I found some old post about the PersistenceUnit at http://forums.sun.com/thread.jspa?threadID=760506 and stating:

"I'm not 100% sure that this is the correct solution, but it works for me. I modified the em field in the com.sun.bookstore6.backing.AbstractBean class to no longer be static. My code now looks like:

@PersistenceContext(name = "books")
private EntityManager em;

The reason that I did this was that I found the code that generated the exception and saw that it was doing a modifier check on the field before doing the injection. If an object instance was supplied to the injection code, the field being injected could not be static."

So what I tried is annotate the EntityManager in the BookDBAO class:

public class BookDBAO {
private ArrayList books;
@PersistenceContext(name = "books")
private EntityManager em;

But this is also not working. I have also tried some poking into the dark and tried to use another name for "books" and tried "jdbc/BookDB" "DerbyPool" but this is also not working. Any idea?

Tai

Marina Vatkina

Can you post persistence.xml? Did you start Derby database?

thanks,
-marina

glassfish@javadesktop.org wrote:
> I found some old post about the PersistenceUnit at http://forums.sun.com/thread.jspa?threadID=760506 and stating:
>
> "I'm not 100% sure that this is the correct solution, but it works for me. I modified the em field in the com.sun.bookstore6.backing.AbstractBean class to no longer be static. My code now looks like:
>
> @PersistenceContext(name = "books")
> private EntityManager em;
>
> The reason that I did this was that I found the code that generated the exception and saw that it was doing a modifier check on the field before doing the injection. If an object instance was supplied to the injection code, the field being injected could not be static."
>
> So what I tried is annotate the EntityManager in the BookDBAO class:
>
> public class BookDBAO {
> private ArrayList books;
> @PersistenceContext(name = "books")
> private EntityManager em;
>
> But this is also not working. I have also tried some poking into the dark and tried to use another name for "books" and tried "jdbc/BookDB" "DerbyPool" but this is also not working. Any idea?
>
> Tai
> [Message sent by forum member 'taitruong' (taitruong)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357317
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

taitruong
Offline
Joined: 2009-07-19

Okay. I found the problem. I have manually created the bookstore.jar without adding the src/META-INF/persistence.xml

The easiest way is using Ant to create the jar files like:
1. Open the command prompt
2. go to glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore1>
3. Enter "ant"
4. copy the bookstore.jar to the eclipse project "bookstore1" from glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore\dist
5. Start Glassfish in Eclipse
6. Deploy bookstore1
7. Open the link http://localhost:8080/bookstore1/bookstore

Now I get this:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20090424-r4050): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'WEB_BOOKSTORE_BOOKS' does not exist.
Error Code: -1
Call: SELECT BOOKID, ONSALE, TITLE, PRICE, INVENTORY, DESCRIPTION, CALENDAR_YEAR, SURNAME, FIRSTNAME FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
bind => [203]
Query: ReadObjectQuery(referenceClass=Book sql="SELECT BOOKID, ONSALE, TITLE, PRICE, INVENTORY, DESCRIPTION, CALENDAR_YEAR, SURNAME, FIRSTNAME FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)")

Before I have properly started "ant create-tables" and all 181 SQLs (tutorial.sql copied from the JEE5 since in JEE6 it is incomplete) has been executed.

@Marina
In the post http://forums.java.net/jive/thread.jspa?messageID=356461&tstart=0
you have mentioned:
"...to change the persistence.xml to set the EclipseLink property:
"eclipselink.ddl-generation" either to "drop-and-create-tables" or to
"create-tables".

If the steps included loading DDL, you missed that step.

The latest V3 builds have support for automatic table creation requested via
asadmin deploy command options."

So this is not necessary to change anymore or should I change the persitence.xml?

Tai

taitruong
Offline
Joined: 2009-07-19

Okay. I have edit persistence.xml to:

jdbc/__default

And now my browser says:
The application is unavailable. Please try later.

The server.log is:
INFO: Loading application bookstore1 at /bookstore1
INFO: Deployment of bookstore1 done is 3,032 ms

INFO: =======================================================
The number of hits is: 1
=======================================================

SEVERE: StandardWrapperValve[BookStoreServlet]: PWC1406: Servlet.service() for servlet BookStoreServlet threw exception
com.sun.bookstore.exception.BookNotFoundException: Couldn't find book: 203
at com.sun.bookstore1.database.BookDBAO.getBook(BookDBAO.java:58)
at com.sun.bookstore1.servlets.BookStoreServlet.doGet(BookStoreServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1461)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:346)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:216)
at com.sun.bookstore1.filters.HitCounterFilter.doFilter(HitCounterFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:259)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:291)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:187)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:647)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:351)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:249)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:146)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:655)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:905)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:161)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:136)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

Marina Vatkina

Which code creates book #203? This seems like you are now able to call the
bookstore code.

Regards,
-marina

glassfish@javadesktop.org wrote:
> Okay. I have edit persistence.xml to:
>
>
>
> jdbc/__default
>
>
>
>
>
>
> And now my browser says:
> The application is unavailable. Please try later.
>
> The server.log is:
> INFO: Loading application bookstore1 at /bookstore1
> INFO: Deployment of bookstore1 done is 3,032 ms
>
> INFO: =======================================================
> The number of hits is: 1
> =======================================================
>
> SEVERE: StandardWrapperValve[BookStoreServlet]: PWC1406: Servlet.service() for servlet BookStoreServlet threw exception
> com.sun.bookstore.exception.BookNotFoundException: Couldn't find book: 203
> at com.sun.bookstore1.database.BookDBAO.getBook(BookDBAO.java:58)
> at com.sun.bookstore1.servlets.BookStoreServlet.doGet(BookStoreServlet.java:75)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
> at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1461)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:346)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:216)
> at com.sun.bookstore1.filters.HitCounterFilter.doFilter(HitCounterFilter.java:71)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:259)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:216)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:291)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:187)
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:647)
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
> at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
> at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:351)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:249)
> at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:146)
> at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:746)
> at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:655)
> at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:905)
> at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:161)
> at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:136)
> at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
> at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
> at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
> at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
> at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
> at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> [Message sent by forum member 'taitruong' (taitruong)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357329
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

taitruong
Offline
Joined: 2009-07-19

Thanks for your support Marina. I will close the post as "answered".

Tai

Marina Vatkina

Thanks for the update Tai.

Can you please file a docs bug for the tutorial to be fixed? It will also help
others who try it to find a solution.

Regards,
-marina

glassfish@javadesktop.org wrote:
> Thanks for your support Marina. I will close the post as "answered".
>
> Tai
> [Message sent by forum member 'taitruong' (taitruong)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357338
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

taitruong
Offline
Joined: 2009-07-19

Sure! Yes tell me where the link is for reporting docs bugs.

Tai

Marina Vatkina

It's the same as the rest of GF:
https://glassfish.dev.java.net/servlets/ProjectIssues

Chose V3 as the versions and docs as the subcomponent.

thanks,
-marina

glassfish@javadesktop.org wrote:
> Sure! Yes tell me where the link is for reporting docs bugs.
>
> Tai
> [Message sent by forum member 'taitruong' (taitruong)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357343
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

taitruong
Offline
Joined: 2009-07-19

Sorry but the server.og doesn't say anything about EclipseLink. I did some debugging and it the emf/EntityManagerFactory gets injected properly. But when the factory tries to create an EntityManager in:
public BookDBAO(EntityManagerFactory emf) throws Exception {
em = emf.createEntityManager();

An IllegalStateException gets thrown:
Unable to retrieve EntityManagerFactory for unitName null

The complete server.log is:
Jul 23, 2009 11:11:56 PM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
C:\Programme\Java\jdk1.6.0_14\bin\java.exe
-cp
E:/glassfishv3/glassfish/modules/glassfish.jar
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=192m
-XX:NewRatio=2
-XX:+LogVMOutput
-XX:LogFile=E:\glassfishv3\glassfish\domains\domain1/logs/jvm.log
-Xmx512m
-client
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Djavax.net.ssl.trustStore=E:\glassfishv3\glassfish\domains\domain1/config/cacerts.jks
-Djavax.net.ssl.keyStore=E:\glassfishv3\glassfish\domains\domain1/config/keystore.jks
-Djava.security.policy=E:\glassfishv3\glassfish\domains\domain1/config/server.policy
-Dcom.sun.aas.instanceRoot=E:\glassfishv3\glassfish\domains\domain1
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory
-Djava.security.auth.login.config=E:\glassfishv3\glassfish\domains\domain1/config/login.conf
-Djava.endorsed.dirs=E:\glassfishv3\glassfish/lib/endorsed
-Dcom.sun.aas.installRoot=E:\glassfishv3\glassfish
-Djava.ext.dirs=C:\Programme\Java\jdk1.6.0_14/lib/ext;C:\Programme\Java\jdk1.6.0_14/jre/lib/ext;E:\glassfishv3\glassfish\domains\domain1/lib/ext;E:\glassfishv3\javadb/lib
com.sun.enterprise.glassfish.bootstrap.ASMain
-domainname
domain1
-asadmin-args
start-domain,,,--domaindir,,,E:/glassfishv3/glassfish/domains,,,--debug,,,--verbose=false,,,domain1
-instancename
server
-verbose
false
-debug
true
-asadmin-classpath
E:/glassfishv3/glassfish/modules/admin-cli.jar
-asadmin-classname
com.sun.enterprise.admin.cli.AsadminMain
-domaindir
E:/glassfishv3/glassfish/domains/domain1

Jul 23, 2009 11:11:57 PM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: Successfully launched in 31 msec.

INFO: Started bundle org.glassfish.common.internal-api [115]
INFO: Started bundle org.glassfish.transaction.jts [150]
INFO: Started bundle org.glassfish.deployment.autodeploy [61]
INFO: Started bundle org.glassfish.jms.core [136]
INFO: Started bundle org.glassfish.registration.glassfish-registration [95]
INFO: Started bundle org.glassfish.flashlight.framework [74]
INFO: Listening on port 8080
INFO: Network listener http-listener-2 on port 8181 disabled per domain.xml
INFO: Listening on port 4848
INFO: Started bundle org.glassfish.common.container-common [57]

INFO: Started bundle org.glassfish.common.glassfish-api [82]
INFO: The Admin Console is already installed, but not yet loaded.
INFO: Started bundle org.glassfish.deployment.common [63]
INFO: Started bundle org.glassfish.common.glassfish-naming [93]
INFO: Started bundle org.glassfish.transaction.jta [149]
INFO: Started bundle org.glassfish.connectors.runtime [47]
INFO: GlassFish v3 startup time : Felix(1828ms) startup services(750ms) total(2578ms)
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: Started JMXConnector, JMXService URL = service:jmx:rmi:///jndi/rmi://taiPad:8686/jmxrmi

INFO: Started bundle org.glassfish.webservices.jsr109-impl [145]
INFO: Started bundle org.glassfish.ejb.gf-ejb-connector [78]
INFO: Started bundle org.glassfish.web.gf-web-connector [80]
INFO: Started bundle org.glassfish.appclient.server.appclient-connector [20]
INFO: Started bundle org.glassfish.web.beans-integration [192]
INFO: Started bundle org.glassfish.security [177]
INFO: Started bundle org.glassfish.deployment.javaee-full [65]
INFO: Started bundle org.glassfish.persistence.jpa-connector [138]
INFO: Started bundle org.glassfish.connectors.gf-connectors-connector [77]
INFO: Started bundle org.glassfish.scripting.gf-jruby-connector [79]
INFO: Started bundle org.glassfish.extras.osgi-container [170]
INFO: Started bundle org.glassfish.extras.grizzly-container [101]

INFO: Started bundle org.glassfish.deployment.admin [60]
INFO: Started bundle org.glassfish.web.war-util [185]
INFO: SEC1002: Security Manager is OFF.
INFO: Started bundle org.glassfish.security.common [178]
INFO: Started bundle org.glassfish.security.webservices.security [196]
INFO: Security startup service called
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
INFO: Started bundle org.glassfish.security.realms [173]
INFO: Security service(s) started successfully....

INFO: Started bundle org.glassfish.web.glue [189]
INFO: Created HTTP listener http-listener-1 on port 8080
INFO: Created HTTP listener admin-listener on port 4848
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Started bundle org.glassfish.deployment.dol [66]
INFO: Started bundle org.glassfish.ejb.ejb-container [67]

INFO: Started bundle org.glassfish.web.core [188]

INFO: Dual registration of jndi stream handler: factory already defined
INFO: Unknown loader 189.0 class org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader

INFO: Started bundle org.glassfish.web.jstl-connector [147]
INFO: Started bundle org.glassfish.web.jsf-connector [140]
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
INFO: Started bundle org.glassfish.connectors.work-management [197]
INFO: Started bundle org.glassfish.connectors.internal-api [46]
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@74d22e 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: Deployment of bookstore1 done is 52,031 ms

HTH Tai

Snjezana Sevo-Zenzerovic

FWIW, you are pretty close - in English it is "not seeing the forest for
the trees" :-)

glassfish@javadesktop.org wrote:

>There is a german proverb "vor lauter Bäumen den Wald nicht sehen" which literally means "not seeing the forest due to all the trees". I don't know how do you say that in english but you might give me some English lessons :-).
>
>After spending that much time of uninstalling and installing all the different kinds of v3 installations I forgot to take a close look at the log but I got at least a hint where the problem now is. The console says:
>
>INFO: Couldn't create bookstore database bean: Unable to retrieve EntityManagerFactory for unitName null
>
>The error occurs in com.sun.bookstore1.listeners.ContextListener:
>
>public final class ContextListener implements ServletContextListener {
> @PersistenceUnit
> private EntityManagerFactory emf;
>...
> try {
> BookDBAO bookDB = new BookDBAO(emf);
> context.setAttribute("bookDB", bookDB);
> } catch (Exception ex) {
> System.out.println(
> "Couldn't create bookstore database bean: "
> + ex.getMessage());
> }
>
>It seems that the EntityManagerFactory does not get injected. I will do some further investigation and keep you posted. Any hint but somebody?
>
>Tai
>[Message sent by forum member 'taitruong' (taitruong)]
>
>http://forums.java.net/jive/thread.jspa?messageID=357299
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

taitruong
Offline
Joined: 2009-07-19

Good to know :-). It would be also funny to hear how a native English speaking person trying to say in German "Vor lauter Bäumen sehe ich den Wald nicht mehr" :-).

Tai

taitruong
Offline
Joined: 2009-07-19

As mentioned above I had also to change the javadb.properites and remove the "examples/" folders:

file before:
db.create.src=${javaee.tutorial.home}/examples/common/sql/${db.vendor}/tutorial.sql
db.delete.src=${javaee.tutorial.home}/examples/common/sql/${db.vendor}/delete.sql
file after:
db.create.src=${javaee.tutorial.home}/common/sql/${db.vendor}/tutorial.sql
db.delete.src=${javaee.tutorial.home}/common/sql/${db.vendor}/delete.sql

Otherwise I get the following:
E:\glassfishv3\glassfish\docs\javaee-tutorial\examples\web\bookstore1>ant create-tables
Buildfile: build.xml

-pre-init:

init:

check:

tools:

start-db:
[exec] Database already started on host localhost, port 1527.
[exec] Command start-database executed successfully.

delete-tables:

BUILD FAILED
E:\glassfishv3\glassfish\docs\javaee-tutorial\examples\bp-project\database-ant.xml:48: E:\glassfishv3\glassfish\javadb\lib not found.

What's strange though is this entry in the build.properties:
javaee.server.passwordfile=${javaee.tutorial.home}/examples/common/admin-password.txt

Here the there is still pointed to the examples folder. I didn't change it since I am using the anonymous admin user. The "examples/" might be remove in case someone installs it with an admin user. Correct?

Tai

dienh
Offline
Joined: 2005-09-25

I second to this. Wading through hundreds of documents on this website just added more frustration.

taitruong
Offline
Joined: 2009-07-19

I've logged the stack trace:

SEVERE: java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName null
SEVERE: at com.sun.enterprise.container.common.impl.EntityManagerFactoryWrapper.getDelegate(EntityManagerFactoryWrapper.java:91)
SEVERE: at com.sun.enterprise.container.common.impl.EntityManagerFactoryWrapper.createEntityManager(EntityManagerFactoryWrapper.java:101)
SEVERE: at com.sun.bookstore1.database.BookDBAO.(BookDBAO.java:27)
SEVERE: at com.sun.bookstore1.listeners.ContextListener.contextInitialized(ContextListener.java:32)
SEVERE: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4862)
SEVERE: at org.apache.catalina.core.StandardContext.start(StandardContext.java:5551)
SEVERE: at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
SEVERE: at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
SEVERE: at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
SEVERE: at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:693)
SEVERE: at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1951)
SEVERE: at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1638)
SEVERE: at com.sun.enterprise.web.WebApplication.start(WebApplication.java:88)
SEVERE: at org.glassfish.internal.data.EngineRef.start(EngineRef.java:115)
SEVERE: at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:215)
SEVERE: at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:189)
SEVERE: at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:283)
SEVERE: at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:172)
SEVERE: at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:247)
SEVERE: at com.sun.enterprise.v3.admin.CommandRunnerImpl$4.execute(CommandRunnerImpl.java:419)
SEVERE: at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:434)
SEVERE: at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:521)
SEVERE: at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:137)
SEVERE: at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:313)
SEVERE: at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:180)
SEVERE: at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:165)
SEVERE: at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
SEVERE: at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:208)
SEVERE: at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:746)
SEVERE: at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:655)
SEVERE: at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:905)
SEVERE: at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:161)
SEVERE: at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:136)
SEVERE: at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
SEVERE: at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
SEVERE: at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
SEVERE: at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
SEVERE: at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
SEVERE: at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
SEVERE: at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
SEVERE: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
SEVERE: at java.lang.Thread.run(Thread.java:619)

I've tried to find the source code for all the JEE 6 jars but I couldn't find it. Does anybody know where to get it?

Thanks Tai

Snjezana Sevo-Zenzerovic

FWIW, your environment setup steps look fine although I cannot comment
much on the Eclipse part of it... Windows XP by itself should not cause
issues since sample applications have been tested on this platform
prior to Preview release.

Did you try building and deploying sample applications from the command
line, i.e. without using Eclipse? If that works, it would help define
the scope of the problem. I'll also try to track down real live
developers who delivered these two sample applications and ask them to
take a look.

glassfish@javadesktop.org wrote:

>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@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
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

taitruong
Offline
Joined: 2009-07-19

There is a german proverb "vor lauter Bäumen den Wald nicht sehen" which literally means "not seeing the forest due to all the trees". I don't know how do you say that in english but you might give me some English lessons :-).

After spending that much time of uninstalling and installing all the different kinds of v3 installations I forgot to take a close look at the log but I got at least a hint where the problem now is. The console says:

INFO: Couldn't create bookstore database bean: Unable to retrieve EntityManagerFactory for unitName null

The error occurs in com.sun.bookstore1.listeners.ContextListener:

public final class ContextListener implements ServletContextListener {
@PersistenceUnit
private EntityManagerFactory emf;
...
try {
BookDBAO bookDB = new BookDBAO(emf);
context.setAttribute("bookDB", bookDB);
} catch (Exception ex) {
System.out.println(
"Couldn't create bookstore database bean: "
+ ex.getMessage());
}

It seems that the EntityManagerFactory does not get injected. I will do some further investigation and keep you posted. Any hint but somebody?

Tai

Marina Vatkina

Check the server log if there are any messages from EclipseLink about processing
the PU.

Regards,
-marina

glassfish@javadesktop.org wrote:
> There is a german proverb "vor lauter Bäumen den Wald nicht sehen" which literally means "not seeing the forest due to all the trees". I don't know how do you say that in english but you might give me some English lessons :-).
>
> After spending that much time of uninstalling and installing all the different kinds of v3 installations I forgot to take a close look at the log but I got at least a hint where the problem now is. The console says:
>
> INFO: Couldn't create bookstore database bean: Unable to retrieve EntityManagerFactory for unitName null
>
> The error occurs in com.sun.bookstore1.listeners.ContextListener:
>
> public final class ContextListener implements ServletContextListener {
> @PersistenceUnit
> private EntityManagerFactory emf;
> ...
> try {
> BookDBAO bookDB = new BookDBAO(emf);
> context.setAttribute("bookDB", bookDB);
> } catch (Exception ex) {
> System.out.println(
> "Couldn't create bookstore database bean: "
> + ex.getMessage());
> }
>
> It seems that the EntityManagerFactory does not get injected. I will do some further investigation and keep you posted. Any hint but somebody?
>
> Tai
> [Message sent by forum member 'taitruong' (taitruong)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357299
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

taitruong
Offline
Joined: 2009-07-19

Sorry but the server.og doesn't say anything about EclipseLink. I did some debugging and it the emf/EntityManagerFactory gets injected properly. But when the factory tries to create an EntityManager in:
public BookDBAO(EntityManagerFactory emf) throws Exception {
em = emf.createEntityManager();

An IllegalStateException gets thrown:
Unable to retrieve EntityManagerFactory for unitName null

The complete server.log is:
Jul 23, 2009 11:11:56 PM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
C:\Programme\Java\jdk1.6.0_14\bin\java.exe
-cp
E:/glassfishv3/glassfish/modules/glassfish.jar
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=192m
-XX:NewRatio=2
-XX:+LogVMOutput
-XX:LogFile=E:\glassfishv3\glassfish\domains\domain1/logs/jvm.log
-Xmx512m
-client
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Djavax.net.ssl.trustStore=E:\glassfishv3\glassfish\domains\domain1/config/cacerts.jks
-Djavax.net.ssl.keyStore=E:\glassfishv3\glassfish\domains\domain1/config/keystore.jks
-Djava.security.policy=E:\glassfishv3\glassfish\domains\domain1/config/server.policy
-Dcom.sun.aas.instanceRoot=E:\glassfishv3\glassfish\domains\domain1
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory
-Djava.security.auth.login.config=E:\glassfishv3\glassfish\domains\domain1/config/login.conf
-Djava.endorsed.dirs=E:\glassfishv3\glassfish/lib/endorsed
-Dcom.sun.aas.installRoot=E:\glassfishv3\glassfish
-Djava.ext.dirs=C:\Programme\Java\jdk1.6.0_14/lib/ext;C:\Programme\Java\jdk1.6.0_14/jre/lib/ext;E:\glassfishv3\glassfish\domains\domain1/lib/ext;E:\glassfishv3\javadb/lib
com.sun.enterprise.glassfish.bootstrap.ASMain
-domainname
domain1
-asadmin-args
start-domain,,,--domaindir,,,E:/glassfishv3/glassfish/domains,,,--debug,,,--verbose=false,,,domain1
-instancename
server
-verbose
false
-debug
true
-asadmin-classpath
E:/glassfishv3/glassfish/modules/admin-cli.jar
-asadmin-classname
com.sun.enterprise.admin.cli.AsadminMain
-domaindir
E:/glassfishv3/glassfish/domains/domain1

Jul 23, 2009 11:11:57 PM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: Successfully launched in 31 msec.

INFO: Started bundle org.glassfish.common.internal-api [115]
INFO: Started bundle org.glassfish.transaction.jts [150]
INFO: Started bundle org.glassfish.deployment.autodeploy [61]
INFO: Started bundle org.glassfish.jms.core [136]
INFO: Started bundle org.glassfish.registration.glassfish-registration [95]
INFO: Started bundle org.glassfish.flashlight.framework [74]
INFO: Listening on port 8080
INFO: Network listener http-listener-2 on port 8181 disabled per domain.xml
INFO: Listening on port 4848
INFO: Started bundle org.glassfish.common.container-common [57]

INFO: Started bundle org.glassfish.common.glassfish-api [82]
INFO: The Admin Console is already installed, but not yet loaded.
INFO: Started bundle org.glassfish.deployment.common [63]
INFO: Started bundle org.glassfish.common.glassfish-naming [93]
INFO: Started bundle org.glassfish.transaction.jta [149]
INFO: Started bundle org.glassfish.connectors.runtime [47]
INFO: GlassFish v3 startup time : Felix(1828ms) startup services(750ms) total(2578ms)
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: Started JMXConnector, JMXService URL = service:jmx:rmi:///jndi/rmi://taiPad:8686/jmxrmi

INFO: Started bundle org.glassfish.webservices.jsr109-impl [145]
INFO: Started bundle org.glassfish.ejb.gf-ejb-connector [78]
INFO: Started bundle org.glassfish.web.gf-web-connector [80]
INFO: Started bundle org.glassfish.appclient.server.appclient-connector [20]
INFO: Started bundle org.glassfish.web.beans-integration [192]
INFO: Started bundle org.glassfish.security [177]
INFO: Started bundle org.glassfish.deployment.javaee-full [65]
INFO: Started bundle org.glassfish.persistence.jpa-connector [138]
INFO: Started bundle org.glassfish.connectors.gf-connectors-connector [77]
INFO: Started bundle org.glassfish.scripting.gf-jruby-connector [79]
INFO: Started bundle org.glassfish.extras.osgi-container [170]
INFO: Started bundle org.glassfish.extras.grizzly-container [101]

INFO: Started bundle org.glassfish.deployment.admin [60]
INFO: Started bundle org.glassfish.web.war-util [185]
INFO: SEC1002: Security Manager is OFF.
INFO: Started bundle org.glassfish.security.common [178]
INFO: Started bundle org.glassfish.security.webservices.security [196]
INFO: Security startup service called
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
INFO: Started bundle org.glassfish.security.realms [173]
INFO: Security service(s) started successfully....

INFO: Started bundle org.glassfish.web.glue [189]
INFO: Created HTTP listener http-listener-1 on port 8080
INFO: Created HTTP listener admin-listener on port 4848
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Started bundle org.glassfish.deployment.dol [66]
INFO: Started bundle org.glassfish.ejb.ejb-container [67]

INFO: Started bundle org.glassfish.web.core [188]

INFO: Dual registration of jndi stream handler: factory already defined
INFO: Unknown loader 189.0 class org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader

INFO: Started bundle org.glassfish.web.jstl-connector [147]
INFO: Started bundle org.glassfish.web.jsf-connector [140]
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
INFO: Started bundle org.glassfish.connectors.work-management [197]
INFO: Started bundle org.glassfish.connectors.internal-api [46]
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@74d22e 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: Deployment of bookstore1 done is 52,031 ms

HTH Tai