Building Glassfish

For a demo at a developer event next week spent some time on figuring out how to build Glassfish. Glassfish is the next version of Suns J2EE application server and it has been open sourced at JavaOne this year. I did not find a complete how-to right away, but after some searching it came down to some simple steps:

A couple of prerequisites:

  • JDK1.5 (set JAVA_HOME and have $JAVA_HOME/bin in PATH)
  • Maven 1.02 (set MAVEN_HOME and have $MAVEN_HOME/bin in PATH)
  • cvs

Now start building it:

  1. First you need to make sure that you have a network connection to the CVS server at java.net. At home that's no problem, but at the office I had to set up a tunnel through a socks proxy using ssh like this:
    ssh -x -2 -g -L 2401:localhost:2401 tunnel@cvs.dev.java.net
    
    The password is tunnel
  2. Once you're connected, log in to CVS at java.net:
    cvs -d :pserver:guest@localhost:/cvs login 
    
    (password empty)
  3. And get the main module:
    cvs -d :pserver:guest@cvs.dev.java.net:/cvs checkout glassfish/glassfish
    
    If you set up a tunnel in the first step you should replace cvs.dev.java.net with localhost like this:
    cvs -d :pserver:guest@localhost:/cvs checkout glassfish/glassfish
    
    
  4. Now cd to the glassfish directory and edit the project.properties file. In my case I had to adjust the following properties:
    glassfish.os.name
    glassfish.cvs.username
    glassfish.root
    maven.proxy.host
    maven.proxy.port
    
  5. Now you're all set up to get the rest of the code. Do a
    maven checkout
    
    and sit back for a while... this is going to take ~30 minutes or so and will give the all the code that is part of Glassfish.
  6. In order to build it you need two extra steps:
    maven bootstrap
    maven build
    
    The bootstrap step completes fairly quick, the build step is taking up to an hour, so sit back and catch up with some reading.
  7. Now the appserver is build and using a
    maven configure-runtime
    
    The runtime environment will be configured. After this goto the ../publish/glassfish/bin directory and do a
    ./asadmin start-domain domain1
    
    to start the freshly build application server.
  8. You should now be able to acces the admin console on http://localhost:4848 (log in as admin/adminadmin) and the webpages at http://localhost:8080. (You can changes these ports in the project.properties file if you want.)

0 comments:

Post a Comment