如何找到使用JBoss 4.2.3进行编程的jboss服务器正在侦听的端口? [英] How do I find out what port my jboss server is listening on programmatically using JBoss 4.2.3?

查看:157
本文介绍了如何找到使用JBoss 4.2.3进行编程的jboss服务器正在侦听的端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,如何确定我的简单JBoss 4.2.3服务器正在侦听8080端口?

For example, how do I determine that my simple JBoss 4.2.3 server is listening on port 8080?

这是我能找到的最接近的,但这不起作用:

This is the closest I have been able to come, but this doesn't work:

MBeanServerConnection server = (MBeanServerConnection)new InitialContext()
    .lookup("jmx/rmi/RMIAdaptor");
ObjectName on = new ObjectName(
    "jboss:readonly=true,service=invoker,target=Naming,type=http");
String port = (String)server.getAttribute(on, "InvokerURLSuffix");

推荐答案

检查您的启动日志,会有一行:

Check your boot up log, there will be a line:

21:03:10,415 INFO  [Http11AprProtocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8180

最后四个数字是您当前的端口. [以我的情况为8180]

The last four numbers are your current port. [8180 in my case]

这篇关于如何找到使用JBoss 4.2.3进行编程的jboss服务器正在侦听的端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆