带有 JBoss 或 Tomcat 的独立应用程序

发布于 2024-08-26 21:28:29 字数 261 浏览 8 评论 0原文

您好,

我有一个关于部署 Java 应用程序的更具体的问题。

我创建了一个Java应用程序,它是一个WAR文件,可以安装在任何Java应用程序服务器上。这很完美。现在,对于没有 Java 经验的用户,我想以某种方式将我的应用程序与应用程序服务器打包在一起,并将其作为独立版本分发。

问题1:这可能吗? 问题 2:哪种应用程序服务器最适合此目的? 问题3:我应该从哪里开始学习如何做到这一点?

你有什么经验可以和我分享吗?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

抱着落日 2024-09-02 21:28:29

我给你两个建议

  1. 你可以选择tomcat。将您的 war 放入 webapps 文件夹中并将其重命名为 ROOT.war。压缩 tomcat 文件夹。并分发该文件以及如何启动它的说明。这真的很简单。
  2. 第二种选择是使用码头。基本上编写一小段代码来启动jetty服务器,该服务器指向您创建的war(可能存储在同一文件夹甚至jar中),然后编写一些启动脚本或将其制作成exe。

我更喜欢第一个选项,因为它使用 tomcat。

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.

独留℉清风醉 2024-09-02 21:28:29

这取决于您的应用程序。你们有 EJB 吗?如果没有,我们就选择 Tomcat,它更轻并且可以胜任这项工作。如果是,您需要 JBoss 才能正确运行它们。

然后你可以压缩整个服务器并包含你的战争,这应该可以工作。

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.

吲‖鸣 2024-09-02 21:28:29

查看 Winstone servlet 容器,它具有您想要的受支持用例。

这就是 Hudson 持续集成服务器独立运行的方式。

请参阅https://stackoverflow.com/questions/1515654 /what-is-a-lightweight-fast-java-servlet-container/1515804#1515804

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

为你拒绝所有暧昧 2024-09-02 21:28:29

至少对于 JBoss,部署应用程序后压缩整个服务器的简单方法应该可以正常工作。由于 JBoss 包含 Tomcat,我想它也应该可以与 Tomcat 一起使用。

为了让用户更容易启动服务器,您可以提供自定义的runMyServer.bat(或.sh)来执行run.bat -c MyServer - b 127.0.0.1(当然替换为所需的 IP 地址:-)。

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

故事↓在人 2024-09-02 21:28:29

Maven 有一个简洁的插件(jetty-console-maven-plugin),允许创建“可执行”战争(它创建嵌入 Jetty servlet 容器的单个工件)。它非常容易使用,请检查一下。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文