This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrieve the Jnp or RMi port of JBoss server

 
amycybs amit
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am just wondering whether is there any way to retrieve the HOST name, JNP or RMI port where JBoss is running and this app is deployed in the same JBoss.

Regards,
-Amit
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This kind of information can be found in various MBeans. For example, the jboss.system:type=ServerInfo MBeans has a hostName property, and the jboss:service=Naming MBean has a port property. You can use the jmx-console or twiddle to easily scan the mbeans to see which ones contain the information you want, and then have your code query the appropriate mbean properties.
 
amycybs amit
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks peter,

I could browse through the Mbean attributes but couldnt find a proper method to get Attribute rmiPort's value.

This is what I did:

I used MBean: jboss:service=Naming and got all the attributes like port and rmiPort, but still no idea as how to get the value of these attributes.

Any suggestion?

Thanks for the help.

Amit
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I do not understand your question. What tool are you using to access the MBeans? JMX Console? Twiddle? JMX Console, for example, shows the attribute name and value.
 
amycybs amit
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter,

I was writing a JMX client to get these information from the JBoss and was not able to find an proper method in MBean API to get the attribute's value.

I already figured it out and here is the sample:



Thanks for your help.

-Amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic