Exercise 0: Install and Configure
Lab
Environment (10 minutes)
In addition to the contents of this lab's zip file you
should
have the following installed on your computer:
FOR JAVAONE 2009 MACHINE PROVIDED LABS: Glassfish will automatically start when you login to the machine. However there are a few things you need to know.
When you first login into your machine Netbeans will start. You will be prompted by Glassfish to enter the admin username and password. They are:
- Username: admin
- Password: adminadmin

The next important thing to note is that you should not attempt to start or stop Glassfish from within Netbeans. Because of the way Glassfish is configured on these machines, you will need to open a terminal if you want to start or stop the Glassfish service. To do so issue one of these commands in a terminal window:
- Stop Glassfish server:
gf_stop
- Start Glassfish server:
gf_start
- Check Glassfish status:
gf_status
FOR JAVAONE 2009 MACHINE PROVIDED LABS:
Comet is already enabled on the
machines. Glassfish will start automatically with comet enabled. You do
not need to follow the steps below to enable comet.
To use Comet
with GlassFish, add the bold red
line to the GlassFish domain.xml file in the glassfish-v3_install_dir\glassfish\domains\domain1\config
directory:
Code
Sample
from: domain.xml
|
<http-listener port="8080" id="http-listener-1"
address="0.0.0.0" default-virtual-server="server" server-name="">
<property
name="cometSupport" value="true"/>
</http-listener>
|
Or you can also enable comet support in NetBeans IDE.
FOR JAVAONE 2009 MACHINE PROVIDED LABS:
Comet is already enabled on the
machines. Glassfish will start automatically with comet enabled. You do
not need to follow the steps below to enable comet.
In
addition to enable the comet support in domain.xml as above, this can
also be accomplished easily with Netbeans and Glassfish.
-
Switch to the Services window in Netbeans. If you
can't find it, go to the Windows menu and select Services.

-
Right click your Glassfish server and select
Properties.

-
In the Server's Common properties window you should
see a box labeled Enable Comet Support. Check this
box and select OK.

For
this lab we will simulate multiple users in the exercises. To do this
we'll need to setup a second Firefox profile so that we can simulate
two independent browser sessions. This can be accomplished quite easily
using the Mozilla Profile Manager. Here are instructions for the
various operating systems, if you need more information or you have
trouble you can check the Mozilla KB.
FOR JAVAONE 2009 MACHINE PROVIDED LABS: Firefox is already setup with multiple
profiles. When you first login to the machine you will see a prompt to
select a Firefox profile. You should select User 1
the first time. The next time you want to launch a new browser, open a
terminal window and type the command ff. This
will launch Firefox and allow you to select User 2.
You do not need to follow the instructions below to setup multiple
profiles.
Steps To Follow
-
Close the application completely and make sure that
it is not running in the background.
OpenSolaris/Linux
Open a terminal and execute:
firefox -profilemanager
If firefox is not in your path, you need to cd (firefox
program directory) and then execute:
./firefox -profilemanager
MacOS
Assuming the program is installed in the "Applications" folder, launch
Terminal ("Applications -> Utilities -> Terminal") and
enter the
command starting with / after the prompt in Terminal:
/Applications/Firefox.app/Contents/MacOS/firefox
-profilemanager
Windows
Open the Windows "Start" menu, select "Run" (on Windows Vista, use
"Start Search") then type and enter one of the following:
firefox.exe -profilemanager
if the above instructions do not work, include the full path to the
executable surrounded by quotation marks in the "Run" (or Vista "Start
Search") box, as in this Firefox example:
"C:\Program Files\Mozilla Firefox\firefox.exe"
-profilemanager
-
Select Create Profile
-
Click Continue

-
Enter a new profile name and click Done.

-
Finally, uncheck the box that says Don't
ask at startup

Now
when you start Firefox you will be able to choose which profile you
want to use. This will allow you to use Firefox to simulate two browser
sessions by choosing different profiles for each user. The first time
you should select your default profile. Now launch the profile manager
again from your terminal window and select your second user and choose
Start Firefox. If the profile manager does not launch try running this
command and then you should be able to select your second profile (details):
firefox -P -no-remote
Back to top
Next
exercise