The Source for Java Technology Collaboration
User: Password:



Eduardo Pelegri-Llopart

Eduardo Pelegri-Llopart's Blog

Running GlassFish on Mac OS X

Posted by pelegri on November 26, 2005 at 06:08 PM | Comments (4)

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 download
  • Make the J2SE 5.0 be the default JVM. The simplest way is to change a symlink: follow these instructions.
  • 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 available. 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...


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • All went well for me. The installation process is a little brittle; the setup program seems to include absolute paths in the scripts in /bin. This prevents my from moving the top-level folder to another location.Otherwise, good. I'm excited to try deploying some of our larger apps.

    Posted by: bitpuddle on November 28, 2005 at 02:33 PM


  • Great! Let me know how it goes. In the meantime, I have filed issue 90 on the problem with absolute paths.

    Posted by: pelegri on November 28, 2005 at 10:18 PM

  • Worked like a champ for me. I used b30. Thanks!

    Posted by: dang on December 14, 2005 at 08:51 AM

  • Worked perfectly. No hiccups. Just in time to try all the new EJB 3.0 stuff at JavaOne. Thanks! -Joshua Smith

    Posted by: rationalpi on May 06, 2006 at 02:33 PM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds