开发者

Auto start glassfish with RESTless service

开发者 https://www.devze.com 2023-04-05 00:53 出处:网络
I\'ve been looking for instructions on how to automatically start my GlassFish server with my RESTful application on top of it.I have it installed via the NetBeans IDE and I normally control it throug

I've been looking for instructions on how to automatically start my GlassFish server with my RESTful application on top of it. I have it installed via the NetBeans IDE and I normally control it through NetBeans but I need to transit开发者_如何学Goion away from the dev environment to a test environment. Links to tutorials would be appriciated.


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.

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

  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.
  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. That directory will contain the compiled and packaged projet (jar, war or ear depending on the project type). 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.

Personally I prefer option 2 but that may be a matter of taste. Thorbjørn already explained yet another possibility, via the autodeploy folder. Whichever you choose, the application will start once deployed and will automatically start every time the Glassfish server starts.


Create a WAR or EAR and put it in the autodeploy folder in the domain.

Then it will start every time Glassfish is started.

Additionally under Windows you can use the asadmin create-service facility to create a service (.NET required).

0

精彩评论

暂无评论...
验证码 换一张
取 消