简体   繁体   English

使用RESTless服务自动启动glassfish

[英]Auto start glassfish with RESTless service

I've been looking for instructions on how to automatically start my GlassFish server with my RESTful application on top of it. 我一直在寻找有关如何使用我的RESTful应用程序自动启动GlassFish服务器的说明。 I have it installed via the NetBeans IDE and I normally control it through NetBeans but I need to transition away from the dev environment to a test environment. 我通过NetBeans IDE安装它,我通常通过NetBeans控制它,但我需要从开发环境转换到测试环境。 Links to tutorials would be appriciated. 教程的链接将受到关注。

Create a WAR or EAR and put it in the autodeploy folder in the domain. 创建WAR或EAR并将其放在域中的autodeploy文件夹中。

Then it will start every time Glassfish is started. 然后每次启动Glassfish时它都会启动。

Additionally under Windows you can use the asadmin create-service facility to create a service (.NET required). 此外,在Windows下,您可以使用asadmin create-service工具来创建服务(需要.NET)。

How to start a Glassfish instance when the server starts: that's operating system dependent, on Windows it involves registering Glassfish as a service , for Linux you can follow this tutorial . 如何在服务器启动时启动Glassfish实例:这取决于操作系统,在Windows上它涉及将Glassfish注册为服务 ,对于Linux,您可以按照本教程进行操作

How to start an application with Glassfish, or how to migrate an application from the instance embedded in Netbeans to a production server: two easy ways 如何使用Glassfish启动应用程序,或者如何将应用程序从嵌入Netbeans的实例迁移到生产服务器:两种简单的方法

  1. register your production server in Netbeans , in project properties change the Run target to that newly registered server and deploy via right click on the project in the Projects view, option Deploy. 在Netbeans中注册您的生产服务器 ,在项目属性中将Run目标更改为新注册的服务器,并通过右键单击Projects视图中的项目Deploy选项进行部署。
  2. When you Build a project in Netbeans, a dist subdirectory will be created in the project directory - switch to the Files tab to see it. 在Netbeans中Build项目时,将在项目目录中创建dist子目录 - 切换到“文件”选项卡以查看它。 That directory will contain the compiled and packaged projet (jar, war or ear depending on the project type). 该目录将包含已编译和打包的项目(jar,war或ear,具体取决于项目类型)。 Point your browser to the administrative interface of the production Glassfish (in most installations http://yourproductionserver:4848 ), select the correct application type in the tree on the left, click Deploy and upload the file from the dist subdirectory. 将浏览器指向生产Glassfish的管理界面(在大多数安装中http:// yourproductionserver:4848 ),在左侧的树中选择正确的应用程序类型,单击Deploy并从dist子目录上载文件。

Personally I prefer option 2 but that may be a matter of taste. 我个人更喜欢选项2,但这可能是一个品味问题。 Thorbjørn already explained yet another possibility, via the autodeploy folder. Thorbjørn已经通过autodeploy文件夹解释了另一种可能性。 Whichever you choose, the application will start once deployed and will automatically start every time the Glassfish server starts. 无论您选择哪个,应用程序将在部署后启动,并在每次Glassfish服务器启动时自动启动。

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

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