Lab Exercises
- Exercise 1: Get “glassfish-samples” examples from GlassFish v3 Update center
- Exercise 2: Get “Java EE 6 tutorial” examples from GlassFish v3 Update center
- Exercise 3: Check out “glassfish-samples” examples from java.net (Optional)
- Homework Exercise (for people who are taking Sang Shin’s “Java EE Programming online course”)
Exercise 1: Get “glassfish-samples” examples from GlassFish v3 Update center
(1.1) Start GlassFish v3 update center
Figure-1.11
Figure-1.12
Trouble-shooting Update Tool: For Mac X Users, it may happen that the Update Tool issues the following warning when you click on Available Add-ons.
Figure-1.tb1
To work around this issue:
- Close the Warning dialog box by clicking on OK.
Figure-1.tb2 - Quit the Update Tool.
- Launch GlassFish by right clicking on GlassFish v3 in the Services tab and choose Start.
Figure-1.tb3 - Launch the Admin Console by right clicking on GlassFish v3 in the Services tab and choose View Admin Console.
Figure-1.tb4 - Eventually close the Register dialog box by clicking on Cancel.
Figure-1.tb5 - Click on Available Add-ons.
Figure-1.tb6 - From there, you will get a right panel very similar to the one obtained via the Update Tool, except that the name of the components are not humanized.
Notice also that you will be not advertised from necessary dependencies, but that they will be added silently without needing to check them.
Figure-1.tb7 - Once the add-ons have been installed, quit the Admin Console and restart GlassFish server.
- Repeat steps 3 to 8 for further installations
(1.2) Get “Java EE Sample Applications” (from the update center)
- Select Available Add-ons on the left.
- Check the checkboxes of the “Java EE Sample Applications Full Profile” and “Java EE Sample Applications Web Profile”.
If you install via the Admin Console (Troubleshooting Update Tool) the names of the add-ons to be installed are
javaee-samples-full and javaee-samples-web respectively. - Click Install icon.
Figure-1.21
Figure-1.22
Figure-1.23
- Observe that the sample applications are installed under <GlassFish-v3-Installation-Directory>/glassfish/samples directory.
2. Open a sample project.
Figure-1.24
- Browse down to <GlassFish-v3-Installation-Directory>/glassfish/samples directory.
Figure-1.25
- Expand javaee6->web->servlet.
- Select annotation-war and click Open Project.
Figure-1.26
- Observe that the annotation-war NetBeans project is opened.
Figure-1.27
Exercise 2: Check out “Java EE 6 Tutorial” examples from GlassFish v3 update center
(2.1) Install “Java EE 6 Tutorial”
Figure-2.11
If you install via the Admin Console (Troubleshooting Update Tool) the name of the add-on to be installed is javaee-tutorial.
Figure-2.12
- Observe that the sample applications are installed under <GlassFish-v3-Installation-Directory>/glassfish/docs/javaee-tutorial directory.
- Close the GlassFish v3 Update center.
(2.2) Open a project
Figure-2.21
- Observe that the order project is opened.
Figure-2.22
Figure-2.23
Figure-2.24
(3.1) Get an account from java.net
2. Follow the registration steps.
Figure-3.11
(3.2) Check out “glassfish-samples” module.
- Start NetBeans IDE (if you have not done so yet).
- Selec Team from top-level menu and select CVS->Checkout.
Figure-3.21
- For the CVS Root field, enter :pserver:<your-java.net-account>@cvs.dev.java.net:/cvs
- For the Password field, enter password of your java.net account.
- Click Next.
Figure-3.22
3. Provide “module to check out” information.
- For the Module field, enter glassfish-samples.
- For the Local Folder field, enter a local directory of your choice.
- Click Finish.
Figure-3.23
- Observe that the files are being checked out. It might take up to 20 minutes (or longer if your network is slow).
Figure-3.24
4. Open the project. (You can open the project from the local CVS directory – C:\javaee6-samples\glassfish-samples\ws\javaee6\…) You can open these projects later in the same way you open any NetBeans projects.
(3.3) Explore the project
Figure-3.31
Figure-3.32
- Observe the opened project.
Figure-3.33
Homework Exercise (for people who are taking Sang Shin’s “Java EE Programming online course”)