简体   繁体   中英

How to deploy war with embedded jetty server

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM