8 July 2008

Eclipse Europa GlassFish Problems

OK, it's my fault. I do not RTFM, but usually try out the stuff immediately without much reading.

Recently I wanted to check out the GlassFish application server (version 2) together with Eclipse (version 3.3 or Europa) and encountered some problems. Here is my minimalist conclusion:
  • Download the latest version of GlassFish, in my case it was 2ur2-b04.
  • Read the documentation, there is more to do than just unpack the archive and start it.
  • Do it! Go there! Read it!
  • java -Xmx256m -jar glassfish-installer-v2ur2-b04-windows.jar is obvious...
  • Now comes an important part: Probably you do not want GlassFish to live in the /glassfish-folder, I would rather have it in something like /glassfish-2ur2-b04 for this version. So
  • Copy and/or rename the newly created and filled directory glassfish to your liking. This has to be done before you continue! You can't do that later.
  • Go into this folder and execute lib\ant\bin\ant -f setup.xml as shown in the GlassFish documentation. This should finish the installation.
For the integration of GlassFish with Eclipse, there is an excellent description on the GlassFish site. Unfortunately, there are still some holes in it (and of course I did not read it in the first place, remember, I do not RTFM :-)
  • To create a new server in Eclipse JEE perspective, use the "New Server" wizard in the "Server" tab. But where is GlassFish?
Eclipse Europa - New Server - where is GlassFish
  • So click on the "Download additional server..." link
  • When working behind a proxy, this may take long and not list GlassFish in the end. The reason is that an https-Proxy has to be configured in Eclipse.
Eclipse Europa - Network Settings SSL Proxy
  • Now you are able to create the new server. If the wizard tells you that it can't find some appserv-rt.jar, then you forgot to call ant -f setup.xml during installation of GlassFish (as listed above).
Eclipse Europa - GlassFish V2 - where is appserv-rt.jar
  • This is because GlassFish comes with it's jars in the pack200 format, which do not end with .jar but with .jar.pack.gz and are unpacked during installation. (Manually unpacking unpack200 lib\appserv-rt.jar.pack.gz lib\appserv-rt.jar does not help here. You need to call the set-up...)
  • Start the server. If you get error messages that the system can't find some path and the start-up fails with a timeout after a minute then you did not move/rename the /glassfish-folder to the desired destination before calling the setup.
  • This is because GlassFish has his scripts like asadmin.bat contain absolute paths written during setup, e.g.
    setlocal
    call "C:\download\glassfish\config\asenv.bat"
    set Path=%AS_INSTALL%\bin;%AS_ICU_LIB%;%PATH%
  • Enjoy the finally starting GlassFish, serving it's index page at port 8080:
GlassFish V2 or SunAppServer V9
Now is it GlassFish 2.2 or Sun's Application Server 9.1? ;-)

2 comments:

Arun Gupta said...

This is Sun Java System Application Server 9.1 UR2 (now renamed as Sun GlassFish Enterprise Server 2.0) or GlassFish v2 UR2.

I've a screencast that shows GlassFish/Europa integration at:

http://blogs.sun.com/arungupta/entry/screencast_ws6_eclipse_europa_and

A similar entry for GlassFish/Ganymede is at:

http://blogs.sun.com/arungupta/entry/glassfish_on_eclipse_ganymede

Peter Kofler said...

Thank you for the links. Your webcasts are very detailed. There can never be enough documentation how to do things proper :-)