如何通过嵌入式码头服务器部署战争 [英] How to deploy war with embedded jetty server

查看:107
本文介绍了如何通过嵌入式码头服务器部署战争的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有嵌入式码头服务器的战争文件.我想在线部署它.我应该先做什么?我尝试将其在IDE中运行良好,但是我对如何在线部署它感到困惑?我不想每次尝试像ID​​E一样运行应用程序时都启动服务器.例如,我想输入"http://119.81.44.73/myapp",那么我的主页就会显示出来.我可以寻求帮助以指导如何执行此操作.或是否需要任何配置才能在线部署它?

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?

推荐答案

WAR文件旨在部署到诸如Tomcat或Jetty之类的独立应用程序服务器中.嵌入式码头反之亦然.您有一个独立的Java应用程序,并且在您的应用程序内部,启动了以相同进程运行的Jetty服务器.通过该配置,您可以通过Web界面增强应用程序,甚至可以将其他Web应用程序(WAR)部署到嵌入式Jetty中.

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.

因此,使用包含嵌入式Jetty的WAR毫无意义.如果您嵌入Jetty,则您的应用程序应该是具有主类的普通JAR.如果您能够通过IDE启动应用程序,那么下一步将是构建JAR并尝试通过命令行启动它.为此,创建一个批处理文件或Shell脚本.所有的Jetty JAR都应该在类路径中.

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.

如果这一切都可以在您的本地计算机上运行,​​则可以将所有必需的文件(应用程序JAR,Jetty JAR和您的启动脚本)复制到您的服务器上.

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.

这篇关于如何通过嵌入式码头服务器部署战争的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆