I am using following code for getting values of http port for JBoss 6.1 EAP. This code worked perfectly fine in JBoss 7.1 AS.
Following is the code:
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName socketBindingMBean = new ObjectName("jboss.as:socket-binding-group=standard-sockets,socket-binding=http");
Integer port = (Integer) mBeanServer.getAttribute(socketBindingMBean, "boundPort"));
This code works fine if I deploy the WAR after the server has started, but it fails to work during start up. Is there a change in which JBoss loads its modules? How can I get this information at startup?