带有 JBoss 或 Tomcat 的独立应用程序
您好,
我有一个关于部署 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我给你两个建议
我更喜欢第一个选项,因为它使用 tomcat。
I have two suggestions for you
I prefer the first option as this uses tomcat.
这取决于您的应用程序。你们有 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.
查看 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
至少对于 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 executerun.bat -c MyServer -b 127.0.0.1
(substituting the desired IP address of course :-).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.