简体   繁体   English

Glassfish服务器:如何从glassfish应用程序中获取应用程序部署的名称?

[英]Glassfish server: How to get name of application deployment from inside glassfish application?

I'm running jruby + java inside glassfish application container. 我在glassfish应用程序容器中运行jruby + java。 I wonder if there is a way to get the name of application deployment from inside glassfish application. 我想知道是否有办法从glassfish应用程序中获取应用程序部署的名称。 (appl is deployed using asadmin deploy --name ...) (appl使用asadmin部署--name ...部署)

In other words, I'm looking for a way for an application (java or ruby code running) to know under which name it has been deployed. 换句话说,我正在寻找一种方法来运行应用程序(运行java或ruby代码),以了解它已部署的名称。

Or maybe it there some other way to detect what deployment command was used to deploy the application from inside the application. 或者可能还有一些其他方法可以检测用于从应用程序内部部署应用程序的部署命令。

String anmae = (String) initialContext.lookup("java:app/AppName"); String anmae =(String)initialContext.lookup(“java:app / AppName”);

see http://javahowto.blogspot.nl/2009/12/how-to-get-module-name-and-app-name.html http://javahowto.blogspot.nl/2009/12/how-to-get-module-name-and-app-name.html

Are you referring to the command asadmin list-applications ? 你指的是命令asadmin list-applications it will show you what applications have been deployed to the server. 它将向您显示已部署到服务器的应用程序。 You can also check from the admin console (usually at localhost:4848 ) and click on the List-Applications from there. 您还可以从管理控制台(通常在localhost:4848)进行检查,然后单击列表 - 应用程序。

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

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