简体   繁体   English

在Web上部署Java编码的服务器jar

[英]Deploying java coded server jar on web

I have coded a Jersey based java server which is all wrapped in one excecutable jar. 我已经编码了一个基于Jersey的java服务器,它全部包装在一个可执行的jar中。

I am looking for a web host service in which i can deploy the jar and run it. 我正在寻找可以在其中部署jar并运行它的Web主机服务。

I saw some dedicated servers which can do this but this is overshooting the need, any suggestions? 我看到一些专用服务器可以做到这一点,但这超出了需求,有什么建议吗?

As per your comment I understand that you created a web application with a Jetty embedded server . 根据您的评论,我了解您使用Jetty嵌入式服务器创建了一个Web应用程序。

I think the best solution for you in this case is to get a virtual machine host, install JRE, upload your *.jar and run it from there. 我认为在这种情况下,最适合您的解决方案是获取虚拟机主机,安装JRE,上传*.jar并从那里运行它。 Given firewall permissions and correct configuration you should be able to receive requests on the 80 port. 有了防火墙权限和正确的配置,您应该能够在80端口上接收请求 Cons? 缺点? It costs. 它的成本。 A lot. 很多。

Most of the Java hosts have already a servlet container running (almost always Tomcat ) and you can only deploy your web application in it. 大多数Java主机已经在运行servlet容器(几乎总是Tomcat ),并且您只能在其中部署Web应用程序。 Having an embedded Jetty server messes up everything for you. 拥有嵌入式Jetty服务器会为您带来麻烦。

I strongly suggest you to detach your web application (or as you called it REST server ) from Jetty and deploy the *.war in any of the multiple free Java hosts to test it online. 我强烈建议您从Jetty分离Web应用程序(或称为REST服务器 ),并在多个免费Java主机中的任何一个中部署*.war进行在线测试。


EDIT 编辑

Thanks to you I made a deeper research on the topic and found an interesting guide to deploy a web application with embedded Jetty server in Heroku . 感谢您,我对该主题进行了更深入的研究,并找到了一个有趣的指南,用于在Heroku中部署具有嵌入式Jetty服务器的Web应用程序。 I've never tried it nor I know if its free, but maybe you can give a try. 我从未尝试过它,也不知道它是否免费,但是也许您可以尝试一下。

Digital Ocean work pretty well for me. Digital Ocean对我来说很好。 Their basic packages are really cheap and you get root control over your own machine, meaning you can host whatever you want without restrictions. 它们的基本软件包确实很便宜,您可以对自己的计算机进行root控制,这意味着您可以不受限制地托管任何内容。 The only downside is that they are pretty old school - you have to set up EVERYTHING yourself, including firewalls etc. There are a lot of guides available on their website though, which makes life a lot easier! 唯一的缺点是,它们是一门古老的学校-您必须自己设置一切,包括防火墙等。不过,他们的网站上有很多指南,这使生活变得更加轻松!

http://www.digitalocean.com http://www.digitalocean.com

I know this is a touch redundant but I don't have voting or comment rights yet so this is the only method for me to communicate. 我知道这有点多余,但是我还没有投票或发表评论的权利,所以这是我交流的唯一方法。

Digital Ocean is a solid choice. Digital Ocean是一个可靠的选择。 I am paying 5$ a month for a VM with 512 Mb Ram and 20 gigs of storage (which for my use is just fine.) I am still working on my first proper deploy but as stated above there are tons of tutorials to guide you through it. 我每月为具有512 Mb Ram和20 gigs存储空间的VM支付5美元(对于我来说,这还不错。)我仍在进行首次正确部署,但如上所述,有大量教程可以指导您通过它。 I have no prior command line experience but I've managed to get the server running, Created an SSH key, uploaded my landing page and have gotten a test project using Spark as the embedded server up and functional in a matter of a few hours. 我以前没有命令行经验,但是我设法使服务器运行,创建了SSH密钥,上传了我的登录页面,并使用Spark作为嵌入式服务器启动了一个测试项目,并在几个小时内即可正常工作。 The Droplets are easily scalable from what I've seen. 根据我所见,Droplet易于扩展。 I'm still having trouble deploying an Rest based app with Postgres as the DB but it seems more to do with the ports in play than anything else. 我仍然在使用Postgres作为数据库部署基于Rest的应用程序时遇到困难,但似乎更多的是与运行中的端口有关。 Keep getting 404s. 持续获取404。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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