Monday, 15 June 2009

Installing Metro and Glassfish

For a new customer I'm looking at using Sun's Metro. Metro is in fact a SOAP toolstack similar to Apache's Axis. We want to develop webservices that are independent to the application server it has to run. In the end it has to run on Websphere, but this is not what we have on our development PC's. So I created a simple HelloWorld webservice, that I deployed to a Glassfish server. Getting it to work on Glassfish should not be too hard, since it is delivered with Metro (both products of Sun), although I upgraded it. But having it working I tried to get it to work in Weblogic. I may assume that having it working on Weblogic it should also be deployable to Websphere.

In this article I'll summarize my steps on installing Metro and Glassfish. In a follow-up, I'll expand on creating a HelloWorld webservice to deploy on Glassfish and Weblogic. I'll assume that installing Weblogic is straightforward and doable by anyone that can download the installer from otn.oracle.com.

Download


Required Software


The recommended or required setup for developing webservices using Metro and Eclipse can be found on: https://metro.dev.java.net/guide/Required_Software.html.
Based on this list I build following list:
  • Java JDK 6 (1.6.0_13)
  • Glassfish for J2EE Webservice deployment. Used Version 2.1.1, latest production.
  • Metro 1.5
  • Eclipse. Used Eclipse 3.4.2.
  • soapUI. Used 2.5

Download Metro and Glassfish



Install Glassfish and Metro


  1. First install Glassfish. To do that you need to execute the following command:
  2. java -Xms256M -Xmx384M -jar glassfish-installer-v2.1-b60e-windows.jar 

    It appears that the default minimal heapspace is not enough. Following the user-guide a minimum of 256M should be used.
    The command above just unpacks the installation to a subdirectory called ‘glassfish’.. The actual setup is done using ant.
  3. Go to the glassfish directory:

  4. cd glassfish
    chmod -R +x lib/ant/bin

  5. Perform the setup using ant. The ant delivered with Glassfish is 1.7.1. You could use this one. But if you have the same already installed elsewhere on your system you could ofcourse use that.

  6. lib\ant\bin\ant -f setup.xml 

  7. The setup will configure glassfish for the following ports:

    • Using port 4848 for Admin.
    • Using port 8080 for HTTP Instance.
    • Using port 7676 for JMS.
    • Using port 3700 for IIOP.
    • Using port 8181 for HTTP_SSL.
    • Using default port 3820 for IIOP_SSL.
    • Using default port 3920 for IIOP_MUTUALAUTH.
    • Using default port 8686 for JMX_ADMIN.
  8. The Login information is stored in seperate file on the user’s home directory.

  9. Default username for the admin user is: ‘admin’, the password is: ‘adminadmin’.

Installing metro goes about the same.
  1. Extract metro using:
  2. java -jar metro-1_5.jar
  3. Metro is included in Glassfish. But the used Glassfish is from January 23rd 2009 and Metro April 17th 2009. So I suggest updating Metro to be sure we have the latest version.
  4. ant -Das.home=*gf_install_dir* -f *metro_install_dir*/metro-on-glassfish.xml install
    For example
    ant -Das.home=c:\utils\glassfish -f c:\utils\metro\metro-on-glassfish.xml install

Install Eclipse Glassfish plug-in and add Glassfish Server


To have Glassfish started and stopped in Eclipse you’ll need to add Glassfish as a Server. By default Eclipse does not know how to handle J2EE servers like Glassfish. So you’ll have to install the Glassfish plug-in
  1. Open the J2EE perspective
  2. If needed (and not already done) set your proxy-Server, to get plug-ins downloaded.
    1. Go to Window > Preferences > General > Network Connections.
    2. Determine your proxy-server. For example, get it from your browser connection-settings.
    3. Set the Proxy. Normally use the same proxy for all protocols.
  3. Go to the Servers tab (below)
  4. Right-Click > New Server > Download Plugins
  5. Choose the appropriate Glassfish version (Glassfish Java EE 5 Server), accepteer license, etc.and follow the further next-next-finish pages.
  6. In the Server Tab, Right-Click > New Server again.
  7. In the Select server type pane, choose Glassfish>Glassfish v2.1 Java EE 5. and choose next
  8. Fill in or ensure you have the following details:
    • Domain name: domain1
    • Domain directory: *glassfish-home*/domains
    • Administrator Id: admin
    • Administrator Password: adminadmin
  9. Follow the wizard to the end and press finish.
You can now start and stop The Glassfish using the Eclipse icons and/or menu items.
I find it convenient to have Application Servers Admin consoles started in an external browser (Firefox) when opened from Eclipse. To have that, choose Window>Web Browser> 2. Firefox (depending on given choices and possible browsers install sequence).

When you manually start or stop a J2EE server that is registered with Eclipse, Eclipse will know…
You can add Weblogic to Eclipse the same way as Glassfish. You’ll have to install the Weblogic pluging though. Choose the ones from the Oracle main entry (not the BEA), because Weblogic 10.3 is from the Oracle BEA era.

Starting and stopping glasfish by hand

You might want to start/stop Glassfish by hand. The default domain of Glassfish is domain1. To start the domain:
asadmin start-domain domain1
To stop it:
asadmin stop-domain domain1
Where asadmin is in the *glassfish-home*/bin, for example: c:\utils\glassfish\bin.

4 comments :

Unknown said...

Hi,

I am using Glassfish Tools Bundle for Eclipse which supposedly comes with Metro. I set Metro runtime in Preferences -> Web Services -> Metro Preferences but am unable to create a web service client using Metro. I get IWAB0014E Unexpected exception occurred. I am able to create a client on Axis. Is there a setting I am missing? Environment variable? Any help will be much appreciated.

Martien van den Akker said...

Hi Julia,

In the article http://darwin-it.blogspot.com/2009/06/hello-metro.html I described how to create a metro-webservice. That worked for me. You might want to review that one.

Regards,
Martien

Martien van den Akker said...

Hi Julia,

In the article http://darwin-it.blogspot.com/2009/06/hello-metro.html I described how to create a metro-webservice. That worked for me. You might want to review that one.

Regards,
Martien

sam said...

Nice. Thanks for sharing.