views:

202

answers:

5

Hallo,

I have a more specific question about deploying a Java-application.

I have created a Java application, it is a WAR file and can be installed on any Java application server. This works perfect. Now for users who do not have Java experience I want to package somehow my application together with the application server and distribute it as a stand-alone version.

Question 1: Is this possible? Question 2: Which application server would be best for this? Question 3: Where should I start to learn how to do this?

Do you have any experience you can share with me.

Thanks.

+1  A: 

With JBoss at least, the trivial way of zipping the whole server once your app is deployed should work fine. Since JBoss includes Tomcat, I guess it should work with Tomcat as well.

To make it easier for users to start the server, you could provide a custom runMyServer.bat (or .sh) to execute run.bat -c MyServer -b 127.0.0.1 (substituting the desired IP address of course :-).

Péter Török
+2  A: 

It depends on your application. Do you have EJBs? If not, let's go for Tomcat which is lighter and will make the job. If yes you need JBoss to run them properly.

Then you can ZIP the whole server with your War included and this should work.

reef
+2  A: 

Have a look at the Winstone servlet container which has what you want as a supported use case.

This is how the Hudson continuous integration server runs standalone.

See http://stackoverflow.com/questions/1515654/what-is-a-lightweight-fast-java-servlet-container/1515804#1515804

Thorbjørn Ravn Andersen
+1 for Winstone, works pretty well indeed.
Pascal Thivent
+3  A: 

I have two suggestions for you

  1. You can take tomcat. Place your war in the webapps folder and rename it to ROOT.war. Zip up the tomcat folder. And distribute that with instructions on how to start it up. Which is really simple.
  2. Second option is to use jetty. Basically write a small snippet of code to startup the jetty server that points to the war you create (probably store within the same folder or even jar) and then write a little startup script or make it into an exe.

I prefer the first option as this uses tomcat.

Paul
+1 for jetty suggestion.
darren
+1  A: 

Maven has a neat plugin (the jetty-console-maven-plugin) that allows to create an "executable" war (it creates a single artifact that embeds a Jetty servlet container). It's incredibely easy to use, check it out.

Pascal Thivent
+1 very cool. Will have to try that out sometime.
Mads Hansen