How to deploy war with embedded jetty server

和自甴很熟 提交于 2019-12-11 02:23:47

问题


I have a war file with embedded jetty server. I want to deploy it online. What should I do first? I tried it to run in IDE it works well but I am confused on how to deploy it online? I don't want to start server everytime I tried to run my app like what IDE does. For instance, I want to type "http://119.81.44.73/myapp" then my homepage will show up. Can I ask some help to guide how to do this. or Is there any configuration needed to deploy it online?


回答1:


A WAR file is meant to be deployed into a stand alone application server like Tomcat or Jetty. The embedded Jetty is vice versa. You have a standalone Java application and inside your application you start a Jetty server running in the same process. With that configuration you can enhance your application with a web interface or you can even deploy other web applications (WARs) into your embedded Jetty.

So it makes no sense to build a WAR with an embedded Jetty included. If you embed Jetty then your application should be a normal JAR with a main class. If you are able to start your application via a IDE then the next step would be to build a JAR and try to start it via the command line. Create a batch file or shell script for that purpose. All the Jetty JARs should be in the classpath.

If this all works on your local machine you can copy all the necessary files (application JAR, Jetty JARs and your start script) to your server.




回答2:


You probably need to either:

  1. Hire a hosting service,
  2. Install jetty as a *nix daemon / Windows service, or
  3. Install other application server as a *nix daemon / Windows service.

and deploy your war according to usual procedure in each case.



来源:https://stackoverflow.com/questions/18428968/how-to-deploy-war-with-embedded-jetty-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!