Basit
Basit

Reputation: 8626

How to deploy war file to production glass fish server

I am using eclipse and axis 2 framework. I made a webs service. The service is running fine but it is on local host. Now i have installed glass fish 3.1.2 on my server. And i want to deploy my web service there. Eclipse created a Project LoginService, under which there is .war file present under modules directory. But when i right click on it then nothing is happening. Here what i did

I made a project in eclipse.
Created a java class which has two functions
Right click on this java file and then selected other-> web services.
Under run time i selected axis2 framework.
Click next and finish
Then click on the project and selected run on server.

After that eclipse created a project named LoginService, under which there is a .war file, but how can i deploy it to my production server?

Thank you.

Upvotes: 0

Views: 2683

Answers (1)

Basit
Basit

Reputation: 8626

I did it. As i told that first you create dynamic web project, in the configuration section you click on "modify" and then select "Axis2 web Services". Be sure to change the "dynamic web module version" to 2.5 from 3.0. Then click finish. Eclipse will create a project for you. Expand the project node. Then make a class inside "src" folder under "Java Resources". I am assuming that this is your web service. After finalizing code, right click on it and then select New->other->Web Services->Web Service. Then click on the "Web service runtime:Apache axis" and change it to "Apache Axis2". Then "Service EAR project: LoginService ". This is the name that eclipse will create when you click on finish at this stage. If nothing goes wrong, that your web service have been deployed on the glass fish. Now right click on the project Node and select "Run On server" . Eclipse will show you the result . That is for you server that is on your local machine. Now come to the point, what if you want to deploy that service on another machine..... It's very simple.

Remember "Login Service(Service EAR project: LoginService)". Just right click on it and then select "Export->EAR file". Select the destination. Click "Finish". Copy the EAR file on to your another machine. Open glass fish. Click on Applications. Then click on "Deploy" and then locate your Ear file and click finish. That's it. Now your service has been deployed to another server.

Or You can right click on your actual project, select "Export->WAR file" . But i did it only for the EAR file. Hope it will helps other too

Upvotes: 1

Related Questions