How can I obtain port binding information at runtime? (JBoss 5.1)

回眸只為那壹抹淺笑 提交于 2019-12-24 08:18:10

问题


Basically what I want to do is to obtain the port number on which JBoss is listening for HTTP requests (the one that is normally 8080).

I came upon this article, which sounds promising, but unfortunately some of the links are broken and I cannot figure out the part:

ManagementView managementView = getManagementView(); // via JNDI lookup

How could I implement getManagementView()? Or is there any other preferable way to do it?


回答1:


If you are looking for a simpler interface, you might want to consider using their command line tool called Twiddle.

It is powerful command line based tool and doesn't require any Java coding. It can be leveraged from any scripting language (bash, perl, ruby, etc...).

Hope it helps.




回答2:


Answering my own question because I decided what to do.

Obtaining port information at runtime is cumbersome. An easy alternative is to have a config file that must be kept in sync with the actual port number (per hand). Not very clever but it saves you a bunch of headaches!



来源:https://stackoverflow.com/questions/2366489/how-can-i-obtain-port-binding-information-at-runtime-jboss-5-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!