开发者

Stand - alone application with JBoss or Tomcat

Hallo,

I have a more specific question about deplo开发者_如何转开发ying 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.


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.


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.


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 https://stackoverflow.com/questions/1515654/what-is-a-lightweight-fast-java-servlet-container/1515804#1515804


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 :-).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜