COMP 655: Distributed/Operating Systems - Summer 2011
2024-05-11 05:13:04 UTC
Home
Lectures
Assignments
Books, web, tools
 
Turnitin.com
Guidelines
Writing help
Plagiarism
 
DiNo
Glassfish
RESTful client
Menu service
JAX-RS
JAXB
EJB
Java
 
Bulletin board
Contact
 

How to install GlassFish


Preliminaries

  • Download the environment setup script findjava.bat
  • Run the script at a Windows command prompt
  • For example, after downloading findjava.bat

C:\>findjava
JDK=C:\Program Files\Java\jdk1.6.0_02
JRE=C:\Program Files\Java\jre1.6.0_07

  • After the script completes, make sure your %JAVA_HOME% and %PATH% environment variables are set so that JAVA_HOME and the java command are 1.6 or newer.
  • To check the version of java, do

java -version

  • For example

C:\> java -version
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)

  • To check JAVA_HOME, just echo it

echo %JAVA_HOME%

  • For example, 

C:\>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_02

  • Your java runtime and JAVA_HOME do NOT have to be on the same version.
  • Also, check that %ANT_HOME% is NOT set
  • For example

C:\>echo %ANT_HOME%
%ANT_HOME%

  • Continue with the rest of the installation in the same command prompt - do NOT use a different window, or you will lose the changes made by findjava 

Except for work in your web browser, do the following at the same Windows command prompt where you ran findjava

Step 1

cd c:\
mkdir gftemp

Step 2

download the glassfish installer jar, changing its name to gftemp\gf.jar (if you want to install on a Linux machine, use the Linux installer)

Step 3

cd c:\gftemp
java -Xmx256m -jar gf.jar

(if you do this and nothing happens, minimize your windows, in case the Glassfish license agreement got hidden)

Step 4

move glassfish c:\
cd c:\glassfish
lib\ant\bin\ant -f setup.xml

Step 5

bin\asadmin start-domain

Step 6

point your browser at http://localhost:8080

You should see a page that says "Your Application Server is now running"

Step 7

download hello.war into the C:\glassfish\domains\domain1\autodeploy folder. Your browser will probably change the extension from .war to .zip - that's OK for an autodeployed web application - do NOT change the extension (past experience is that changing the file extension in the autodeploy folder confuses GlassFish)

after the hello.zip_deployed file appears in the autodeploy folder, point your browser at http://localhost:8080/hello/

You should see the "Hi, my name is Duke" page 

Step 8

download the restful-client into the C:\glassfish\domains\domain1\autodeploy folder

after the restful-client.zip_deployed file appears, continue with Step 9

More about the RESTful client

Step 9

download menu.war into the C:\glassfish\domains\domain1\autodeploy folder

after the menu.zip_deployed file appears, point your browser at http://localhost:8080/restful-client/

You should see a page titled "RESTful web service client"

Click the GET button

In the lower right-hand frame, you should see "<menu-list/>"

More about the menu service

Step 10

when you're comfortable that things are good, you can delete c:\gftemp

Step 11 - troubleshooting

You can view the server's log file with the admin console, or on Windows, you can use this script, that copies the glassfish server log file into the current folder and opens it with wordpad