Skip to main content

How to configure WebStart and remote JMX?

3 replies [Last post]
deribas
Offline
Joined: 2006-11-09

Hi,

I would like to enable a remote JMX in my WebStart app.

The regular app runs just fine with the following settings:

(extract for ANT script)

The JNLP is set:

I also set these properties in deployment.properties:

deployment.javaws.secure.properties=com.sun.management.jmxremote.port,com.sun.management.jmxremote.ssl,com.sun.management.jmxremote.authenticate

After all of that I would expect to connect JConsole to a remote site localhost:23456
The issue is that is does not work.
I can always see my webstart app in "Local Processes"

Any advice will be appreciated?

Message was edited by: deribas

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sunnychangs
Offline
Joined: 2006-07-26

Did you ask for All Permission in the security section of your JNLP file?

deribas
Offline
Joined: 2006-11-09

Yes I did.

I believe this is all I need:



Are there any restrictions where WebStart can not run server/service?

deribas
Offline
Joined: 2006-11-09

I was able to enable remote JMX programmatically (it all in the java docs...):

// Ensure cryptographically strong random number generator used
// to choose the object number - see java.rmi.server.ObjID
System.setProperty("java.rmi.server.randomIDs", "true");

// Start an RMI registry on port 3000.
LocateRegistry.createRegistry(3000);

// Retrieve the PlatformMBeanServer.
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

// Environment map.
Map env = new HashMap();
env.put("com.sun.management.jmxremote.ssl", "false");
env.put("com.sun.management.jmxremote.authenticate", "false");

JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi");
JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
cs.start();

I am not using any secure properties.

You can execute this code in a static block and connect JConsole to localhost:3000

One improvement that I did is, I catch exceptions around the block that usually indicate that port is busy. This way i can shift the port and enable concurrent executions of the app.

Let me know if you find a better way.