Making Petstore work in NetBeans 6.0

The Petstore sample application from Sun demonstrates a wide range of technologies. It is available in a number of downloads from Sun and is organized in the Blueprints format for projects. However it cannot just be run as it appears on a Windows system. After searching for and reading question and answers about Petstore I have come up with the following steps that worked for me. What follows are the steps necessary to get Petstore to work on a Windows system with NetBeans 6.0.

Assumptions:
Glassfish is installed in C:/glassfish-v2
The user name for Glassfish is admin and the password is adminadmin.

Step 1:
Download the javapetstore-2.0-ea5-installer.jar file from Sun. I found it at https://blueprints.dev.java.net/petstore/

Step 2:
Use javapetstore-2.0-ea5-installer.jar. Execute this jar file (double-click on it) and it will unzip itself in its current directory in a folder called javapetstore-2.0-ea5. Move this directory to the location of your choice for the project. In the remaining instructions it is assumed that you moved it to C:\javapetstore-2.0-ea5

Step 3:
Locate the file build.properties found in C:\javapetstore-2.0-ea5\bp-project\ and open it with a text editor to make the following changes.

Step 4:
Change javaee.home from:
javaee.home=c:/Sun/SDK
to
javaee.home=C:/glassfish-v2

Step 5:
Change javaee.server.passwordfile from:
javaee.server.passwordfile=${javaee.home}/samples/bp-project/passwordfile
to
javaee.server.passwordfile= C:/javapetstore-2.0-ea5/bp-project/passwordfile

Step 6:
In the C:\javapetstore-2.0-ea5\bp-project folder create a file called passwordfile (no extension).

Step 7:
In this file add the following line:
AS_ADMIN_PASSWORD=adminadmin

Step 8:
Start NetBeans and open the project javapetstore-2.0-ea5 that you will find when you browse to C:\javapetstore-2.0-ea5.

Step 9:
Start the GlassFish server. In NetBeans select Window and then Services. A new panel replaces the Projects panel and displays all the services available. Select Servers, right mouse click on Glassfish, and select Start.

Step 10:
In NetBeans return to the Projects panel in the petstore project, go to the Server Resources folder of the project, right mouse click on setup.xml, select Run Target, and select setup. This should create the necessary database files and register them with the persistence engine of GlassFish.

Step 12:
Now Run the main project.

Email this to someoneTweet about this on TwitterShare on LinkedIn0Share on Facebook0

About Ken

I am the Program Coordinator and Chairperson of the Computer Science Technology program at Dawson College in Montreal, Canada. I am also a Program Consultant to and part-time instructor in the Computer Institute of Concordia University's School of Extended Learning.

11 thoughts on “Making Petstore work in NetBeans 6.0

  1. Tom Ethens

    Thank you so much..this helped a LOT!!!!

    This is really great stuff for a newbie like me.

    THANKS ONCE AGAIN!!!!

    Regards,
    Tom

  2. Debbie Scott

    This was great help. I might also add that on Windows Vista, I also
    had to change the admin port in the build.properties file from
    4848 to 8396, which is what the server admin console started up with

  3. Praveen

    Thank you very much. I could solve the issues and the tips matches exactly. If you can include the link to glassfish installation, this page will contain all required contexts. Once again, thanks.

  4. Qing

    Regarding to to the Step 4, javaee.home=C:/glassfish-v2. Is where your Glassfish installed?

    I added GlassFish as a server service to NetBeans via Plugins menu and I do not know where it was located. There is a directory name “gsf1” under the Program Files\NetBeans 6.5.1\gsf1 and GlassFish_V3_Prelude. Can any one tell me how my param to be set?
    Thanks in advance,
    Qing

  5. LeCrow

    Thank you buddy!
    You do better and simpler documentation than the guys at Sun.
    They still need to learn how to make good documentation. With their help it is more difficult to understand what they want you to do than actually writing the code 🙂

    Take it easy!

  6. Andrew

    Hello,

    Does anybody know what is the body of the Petstore’s function:
    bpui.popup.show() called in the tag.jsp file ?? Or maybe someone has created his/her own version if such a function ??

    Andrew

Leave a Reply

Your email address will not be published. Required fields are marked *