Skip to main content

Deploying webservices on Glassfish 3.1 cluster

Posted by bhaktimehta on July 30, 2010 at 1:05 PM PDT

Byron Nevins has posted a very nice blog on offline configuration for Glassfish v3.1 here.

The following blog will show how to deploy a webservices application to a Glassfish 3.1 cluster . You can do additional tasks using the Glassfish Administration Console.

For this blog I tried with the latest promoted b13 of Glassfish 3.1 available here.

Steps

1.Install Glassfish b13 on both machines (jwsdp and adc2180404)

2.DAS  is on adc2180404 other instance is on jwsdp

3.asadmin start-domain
Waiting for the server to start .....
Successfully started the domain : domain1
domain location: /scratch/bhamehta/gf-install/glassfishv3/glassfish/domains/domain1
Log File: /scratch/bhamehta/gf-install/glassfishv3/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

4.asadmin create-cluster mycluster

Command create-cluster executed successfully.

5. asadmin create-node-config --nodehost jwsdp jwsdpconf

Command create-node-config executed successfully.

6.asadmin create-instance --cluster mycluster    --node jwsdpconf mycluster_i1

Successfully created instance mycluster_i1 in the DAS configuration, but failed to create the instance files. Please run:

asadmin --host adc2180404.us.oracle.com --port 4848 create-local-instance --node jwsdpconf mycluster_i1

on jwsdp to complete the transaction.

Command create-instance failed.
 

7(On jwsdp)asadmin --host adc2180404.us.oracle.com --port 4848 create-local-instance --node jwsdpconf mycluster_i1

Attempting to rendezvous with DAS on host adc2180404.us.oracle.com port 4848
Uptime: 1 minutes, 58 seconds

The instance has rendezvoused with the DAS and will be using host adc2180404.us.oracle.com port 4848 for future communication.
servers.server.mycluster_i1.config-ref=mycluster-config
servers.server.mycluster_i1.lb-weight=100
servers.server.mycluster_i1.name=mycluster_i1
servers.server.mycluster_i1.node=jwsdpconf

servers.server.mycluster_i1.property.rendezvousOccurred=true

Command create-local-instance executed successfully.

8(On jwsdp)./asadmin start-local-instance mycluster_i1

Waiting for the server to start ............
Successfully started the instance: mycluster_i1
instancelocation: /Users/bhakti/gf-install/glassfishv3/glassfish/nodeagents/jwsdpconf/mycluster_i1
Log File: /Users/bhakti/gf-install/glassfishv3/glassfish/nodeagents/jwsdpconf/mycluster_i1/logs/server.log
Admin Port: 24848

Command start-local-instance executed successfully. 

 Now deploy a webservice I tried deploying the war which we developed as part of this blog http://weblogs.java.net/blog/bhaktimehta/archive/2010/06/24/ejb-webservi... and could access the wsdl from the instance.

9.(on adc180404 DAS) asadmin deploy  --target mycluster /scratch/bhamehta/ejbwsinwar.war

The application should be deployed on the instance. You can test it using the tester. In my case the machine on which the instance was running was jwsdp

I tried deploying the war which we developed as part of this blog http://weblogs.java.net/blog/bhaktimehta/archive/2010/06/24/ejb-webservi... and could access the wsdl from the instance.

http://jwsdp:28080/WeatherService/Weather?wsdl

To deploy on the das you will need to create an application ref like this

10./asadmin create-application-ref ejbwsinwar

Now you can access the wsdl on the DAS too http://localhost:8080/WeatherService/Weather?wsdl

You can also launch the Glassfish Admin Console on the DAS (Note admin console will not be available on the instances)

in my case we launch the Glassfish Administration console on this location http://adc2180404:4848/

The following image shows a snapshot of the Glassfish Administration Console

Under the applications tab you can see the ejbwsinwar .

 You can also click on Common Tasks and List the deployed applications, deploy applications, manage the targets etc.

 

AttachmentSize
adminconsole.png158.39 KB