Data Access Object (DAO), Java Pet Store Example and

Other Java Technologies 2

 

 

 

 

 

Editing the New Web Server Path

 

Now, in this case, both of the folders (Glassfish installation and pet demo project paths) do not having whitespace(s) anymore.

Next, we need to modify the Glassfish root folder because the original project based on the Sun application server. Open app-server.properties file in any unformatted text editor.

 

Setting new web server path

 

Then, change the following setting:

 

javaee.home=c:/Sun/AppServer

 

To the Glassfish installation path and in this case (yours may be different and change accordingly),

 

C:\sges-v3

 

Save the file and close it.

 

The app-server.properties file content with edited new web server path

 

The path should match with the physical path as shown below (yours may be different and change accordingly)

 

The web server physical path on the local drive

 

Next, open build.properties file in any unformatted text editor.

 

Opening the build.properties file

 

The build.properties file content

 

 

Change the Glassfish installation path from,

 

# path to your application server installation

javaee.home=c:/Sun/SDK

 

To (as in this case. Yours may be different and change accordingly)

 

# path to your application server installation

javaee.home=c:/sges-v3

 

Editing the build.properties file content for the GlassFish web server path

 

Changing Glassfish Web Server admin Password

 

Then, change the following Glassfish admin password file path,

 

javaee.server.passwordfile=${javaee.home}/samples/bp-project/passwordfile

 

To (as in this case. Yours may be different and change accordingly)

 

javaee.server.passwordfile=${javaee.home}/passwordfile

 

Viewing the GlassFish web server admin password in build.properties file

 

Save and close the file.

Then, create the passwordfile file (without any extension) in the C:\sges-v3 folder.

 

Opening the passwordfile of the GlassFish web server

 

Open the passwordfile with any text editor and put the following line of code (Glassfish default admin’s password),

 

AS_ADMIN_PASSWORD=adminadmin

 

Save and close the file.

 

Resetting the GlassFish web server admin password. However in this case we just reset the password to the original one: adminadmin

 

This is the Glassfish default administration username (admin) and password (adminadmin). If yours are different, change accordingly using either the Glassfish Admin Console (shown below) or the passwordfile and setting in the build.properties file as done previously.

 

Changing the GlassFish admin password also can be done through Admin Console provided that you have an access to that page

 

Starting JavaDB Database

 

Next, start the JavaDB server if not started yet.

 

Starting the JAvaDB/Derby database engine

 

Make sure there is no error.

 

Output for the JavaDB/Derby database server starting process

 

Starting Glassfish Web Server

 

Then, start the Glassfish v3 server if not started yet. In Services page, select GlassFish v3 link under Servers folder > right click mouse > select Start.

 

Starting the GlassFish web server

 

 

The GlassFish v3 web server has been started and running

 

Make sure there is no error which is visible in Glassfish v3 output window.

 

The GlassFish v3 web server starting activities log

 

Testing Glassfish Web Server

 

The Glassfish should be running now. You can test it by entering http://localhost:8080/ in the Internet browser address bar as shown in the following screenshot.

 

 

 

 

 

 

 

-----------------------------------------------------------------

 

 

Testing GlassFish web server from Internet Browser

 

Running Java Pet Store Application

 

Back to our Java Pet Store, now, run the setup script. In Files page, expand setup folder > select setup.xml folder > right click mouse > select Run Target menu > select setup sub menu.

 

Running the setup script for the Java Pet Store demo application example

 

Make sure there is no severe error that can be seen in the output window.

 

The java application activities log

 

The following is another clean run output messages.

 

check:

tools:

create-pool-local:

Registering jdbc-connection-pool PetstorePool.

ds=org.apache.derby.jdbc.ClientDataSource

check:

tools:

create-jdbc-connection-pool:

Deprecated syntax, instead use:

asadmin --port 4848 --host localhost --passwordfile c:/sges-v3/passwordfile --user admin create-jdbc-connection-pool [options] ...

com.sun.enterprise.admin.cli.CommandException: remote failure: A resource named PetstorePool already exists.

 

 

Command create-jdbc-connection-pool failed.

Result: 1

create-resource-local:

Registering jdbc resource jdbc/PetstoreDB.

check:

tools:

create-jdbc-resource:

Deprecated syntax, instead use:

asadmin --port 4848 --host localhost --passwordfile c:/sges-v3/passwordfile --user admin create-jdbc-resource [options] ...

 

Command create-jdbc-resource executed successfully.

delete-db:

driver=org.apache.derby.jdbc.ClientDriver

url=jdbc:derby://localhost:1527/petstore;create=true;

user=APP

password=APP

Executing resource: C:\javapetstore-2.0-ea5\setup\sql\javadb\delete.sql

9 of 9 SQL statements executed successfully

create-db:

Executing resource: C:\javapetstore-2.0-ea5\setup\sql\javadb\petstore.sql

417 of 417 SQL statements executed successfully

Executing commands

1 of 1 SQL statements executed successfully

setup:

BUILD SUCCESSFUL (total time: 11 seconds)

 

Finally, run the Java pet store demo project. From Projects page, select petstore project folder > right click mouse > select Run menu.

 

Running the Java Pet Store in NetBeans

 

There should be no severe error(s) both for application and Glassfish web server.

 

The output for the Java application running

 

The GlassFish v3 web server activities log

 

Java Pet Store in Action

 

The following screenshots are the expected output.

 

Java Pet Store seen in Internet Browser

 

Click the "Enter the Store" link and explore the site!

 

A very nice pets seen in browser for Java Pet Store demo example

 

Well, another cute exotic bird found in Java Pet Store demo example

 

Your task: Click the Seller link and sell your pets!

 

 


  java Pet Store 1 | Back to Main