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

jmx management port number

 
luri ron
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i change the port number to use the one from my own configuration after the java process start?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you not need to change the port number before the java process started? I'm not sure you can dynamically alter listening port for JMX queries
 
Dawn Charangat
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use the JMXConnection(ip,port,username,password) constructor to do that. Almost always, the u/n and p/w are "admin"
 
luri ron
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you meant JMXConnector? but this is for the client side to connect to the server.

i want to change the port number of the server side. when the server is brought up. the default iimplementation of JMX management start the registry on the port number, and i want to see if there is a way to intercept it and use the port number from my config file instead of using the system property from the startup script.

any thought on this? thanks.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What server are you running? Some servers might allow you to override using a -D runtime property...
 
luri ron
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we can change the property by doing a System.setProperty, but the JMX already start the registry and doing a bunch of stuff. i want to change the port number before JMX start the registry.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic