Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find out what port my jboss server is listening on programmatically using JBoss 4.2.3?

Tags:

jboss

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");
like image 384
Frank Flannigan Avatar asked Dec 16 '10 23:12

Frank Flannigan


People also ask

What is JBoss Management native port?

By default the native interface listens on port 9999 and the http interface listens on port 9990.


2 Answers

Executeps -ef to check the jboss process.

There check for the following parameter.

-Djboss.socket.binding.port-offset=1010

Add 8080 to the offset value, you will get the port that jboss is listening to. Example, for me jboss is listening to 9090 port. So (8080 + offset<1010> = 9090)

like image 112
Vikram Sharma Avatar answered Sep 19 '22 20:09

Vikram Sharma


It's late for answer but you could read the server.xml in jbossweb.sar under deploy directory of your profile. In that file you has the port of Coyote and others configuration parameters. This file is really usefull and it is the same that you use in Tomcat.

Also you can use "lsof -i tcp:8080" to check if this port is binding to JBoss AS or "netstat -nlp". But if you don't know the port I think the best is read server.xml.

I hope the answer could help to anyone who read it.

like image 29
Chema Avatar answered Sep 19 '22 20:09

Chema