Running the Duke’s Tutoring Case Study Application
This section describes how to build, package, deploy, and run the Duke’s Tutoring application.
Setting Up GlassFish Server
Before running the Duke’s Tutoring application, set up the security realm used by Duke’s Tutoring with users and groups. The user names and passwords set in this security realm are used to log in to the administration interface of Duke’s Tutoring.
Duke’s Tutoring’s security realm maps members of the Administrator entity to the Administrator role used in the security constraint annotations in AdminBean.
To Create the JDBC Realm in GlassFish Server
Create the tutoringRealm JDBC security realm in GlassFish Server.
Before You Begin
Make sure GlassFish Server is started as described in Starting and Stopping the GlassFish Server, and Java DB is started as described in Starting and Stopping the Java DB Server.
- In a terminal window, go to:
tut-install/examples/case-studies/dukes-tutoring/dukes-tutoring-war/
- Enter the following command:
ant create-tutoring-realm
This target creates a JDBC realm using the jdbc/tutoring JDBC resource, which will be created when dukes-tutoring-war has been deployed.
Running Duke’s Tutoring
You can use either NetBeans IDE or Ant to build, package, deploy, and run Duke’s Tutoring.
To Build and Deploy Duke’s Tutoring in NetBeans IDE
Before You Begin
You must have already configured GlassFish Server as a Java EE server in NetBeans IDE, as described in To Add GlassFish Server as a Server in NetBeans IDE.
- From the File menu, choose Open Project.
- In the Open Project dialog, navigate to:
tut-install/examples/case-studies/dukes-tutoring/
- Select the dukes-tutoring-war folder.
- Select the Open as Main Project check box and the Open Required Projects
check box.
The dukes-tutoring-common library project is required by dukes-tutoring-war, and will be opened along with dukes-tutoring-war.
- Click Open Project.
Note - The first time you open Duke’s Tutoring in NetBeans, you will see error glyphs in the project pane. This is expected, as the metamodel files used by the enterprise beans for Criteria API queries have not yet been generated.
- Right-click dukes-tutoring-war in the project pane and select Run.
This will build and package the dukes-tutoring-common and dukes-tutoring-war projects and deploy dukes-tutoring-war to GlassFish Server, starting the Java DB database and GlassFish Server if they have not already been started. The jdbc/tutoring JDBC resource will be created at deploy time. After the application has been successfully deployed, the Duke’s Tutoring main interface will open in a web browser if NetBeans IDE has been configured to open web applications in a web browser.
To Build and Deploy Duke’s Tutoring Using Ant
Before You Begin
Make sure GlassFish Server is started as described in Starting and Stopping the GlassFish Server, and Java DB server is started as described in Starting and Stopping the Java DB Server.
- In a terminal window, go to:
tut-install/examples/case-studies/dukes-tutoring/dukes-tutoring-war/
- Enter the following command:
ant all
This command builds and packages the dukes-tutoring-common and dukes-tutoring-war projects, and deploys dukes-tutoring-war to GlassFish Server.
Using Duke’s Tutoring
Once Duke’s Tutoring is running on GlassFish Server, use the main interface to experiment with checking students in and out or sending them to the park.
To Use the Main Interface of Duke’s Tutoring
- In a web browser, open the main interface at the following URL:
http://localhost:8080/dukes-tutoring/
- Use the main interface to check students in and out, and to log when the students go to the park.
To Use the Administration Interface of Duke’s Tutoring
Follow these instructions to log in to the administration interface of Duke’s Tutoring and add new students, guardians, and addresses.
- In a web browser, open the administration interface at the following URL:
http://localhost:8080/dukes-tutoring/admin/index.xhtml
This will redirect you to the login page.
- At the login page, enter the user name admin@example.com and password javaee.
- Use the administration interface to add or modify students, guardians, or addresses.