Below is a list of problems that I faced while I was testing java EE tutorial 5. I have found some solutions using google, and some of then by myself.
Problem 1:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
Error Code: 0
Call: SQLCall(SELECT BOOKID, PRICE, DESCRIPTION, FIRSTNAME, TITLE, CALENDAR_YEAR, SURNAME, INVENTORY, ONSALE FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?))
Query: ReadObjectQuery(com.sun.bookstore.database.Book)
What I have done: Modify C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\app-server.properties. I modified javaee.home value from c:\\glassfish-v3 to C:\\Program Files\\glassfish-v2.1.
cd C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\web\bookstore1
ant create-tables
You will also need to ensure that the passwordfile is present and contains AS_ADMIN_PASSWORD.
Create C:/Temp/javaee-5-doc-tutorial-1.0_05/javaeetutorial5/examples/bp-project/password.txt and add the following line into a password.txt file:
AS_ADMIN_PASSWORD=adminadmin
Modify C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\app-server.properties
javaee.server.passwordfile=C:\\Temp\\javaee-5-doc-tutorial-1.0_05\\javaeetutorial5\\examples\\bp-project\\password.txt
Define JAVA_HOME
Solution: Copy C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\build.properties.sample to C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\build.properties
Modify:
javaee.tutorial.home=C:\\Temp\\javaee-5-doc-tutorial-1.0_05\\javaeetutorial5
javaee.home=C:\\Program Files\\glassfish-v2.1
cd C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\web\bookstore1
ant create-tables
Problem 2: I got the following error when I tried to run bookstore1 example
package javax.persistence does not exist
The problem occured because bookstore1 example is using library from bookstore/dist/bookstore.jar. The bookstore.jar does not exists when the bookstore1 example is used the first time. Right click on the project bookstore1 and select “Open Required Projects”. Read more at:
http://www.mail-archive.com/java-ee-j2ee-programming-with-passion@googlegroups.com/msg00651.html
Problem 3: I could not create database tables from the example.
C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\web\bookstore1>ant create-tables
Buildfile: build.xml
-pre-init:
init:
check:
tools:
start-db:
BUILD FAILED
C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\app-ser
ver-ant.xml:142: Execute failed: java.io.IOException: Cannot run program “\bin\a
sadmin.bat”: CreateProcess error=3, Path not found
SOLUTION: Modify ..\javaeetutorial5\examples\bp-project\build.properties
Define path for parameter javaee.home (javaee.home=C:/Program Files/glassfish-v3-prelude)