Posted by pelegri
on November 26, 2005 at 6:08 PM PST
How to run the latest GlassFish build (b28) on Mac OS X
Yesterday I tried the latest Mac OS X build of GlassFish . I only tried a simple "hello world" application, and that worked fine but I had to hunt and peek a bit around to find how to do a few things,
so read on for a somewhat detailed description of how to install and set-up GF and how to run that hello world WAR.
I've updated the community documentation at the Wiki to reflect these notes and will file an Issue item
on a couple of problems that I believe are bugs.
I will try installing some more interesting applications later in the week.
To download, install and set up the latest build of GlassFish on Mac OS X:
- Get Mac OS X Tiger (10.4.x). You need this because GF requires J2SE 5.0 (Tiger),
and Apple's Tiger requires the other Tiger (10.4.x). To get Mac OS 10.4, you will need to buy it somewhere, like at Apple's online store , and then
you may want to use their software upgrade to get the latest versions of their components.
- Get the latest J2SE 5.0 from apple. The latest is release 3 . The documentation (javadocs) is a separate
- Make the J2SE 5.0 be the default JVM. The simplest way is to change a symlink: follow these
- Download the latest GF build: currently that is build 28 , take the darwin build. The downloaded file is a self-extracting JAR file.
- Open a terminal window, go to wherever you want to install GlassFish, and move the self-extracting JAR file there. Note that the extractor currently creates a wired-in dependency on the path to the install directory, so if you move the direction you will have to adjust the scripts. IMO, that is a bug, but, for now, plan ahead where to place the directory.
- Run the Jar file a java -Xmx256m -jar glassfish-installer-9.0-b28.jar, accept the license, and a glassfish directory will be created.
- Change directory: cd glassfish.
- Run the setup script. This uses Ant. It is recommended to use the ant that is part of the build; if you want to do that, you would type sh lib/ant/bin/ant -f setup.xml.
That should complete the installation and setup; next is
start and deploy.
There is a document
that briefly describes how to get it started, but here are the steps extracted from there:
- Arrange your PATH to have glassfish-dir/bin. You will use the asadmin command.
- Start the application server as asadmin start-domain domain1. You will see the message: Domain domain1 is ready to receive client requests. Additional services are being started in the background.
- Confirm the application server is up by pointing your browser to http://localhost:8080 . This page may take a bit to present as it requires more services to be available.
Optionally, you can log into the admin console. The console is available at
http://localhost:4848/ ; login as admin with password adminadmin.
The admin console takes a few seconds to come-up; I assume the JSP compiler is initializing and some JSP pages are being compiled.
GlassFish provides autodeploy of applications. To do this, you need to drop the application WAR into the proper directory. A sample hello world app is
Download the WAR file and then copy it into glassfish-dir/domains/domain1/autodeploy/.
- Once the application is auto-deployed - this may take a few seconds - you can visit the simple hello world at: http://localhost:8080/hello.
- To shutdown the application, you can use again the asadmin command as asadmin stop-domain domain1.
Let me know how it goes...