RFR: 7455: Add support for jolokia JMX service connection [v6]

Martin Skarsaune duke at openjdk.org
Sun Feb 4 16:35:06 UTC 2024


On Sat, 3 Feb 2024 09:00:16 GMT, Martin Skarsaune <duke at openjdk.org> wrote:

>> Replaces parts of https://github.com/openjdk/jmc/pull/332
>
> Martin Skarsaune has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits:
> 
>  - Merge remote-tracking branch 'origin/master' into jolokia-support-only
>  - JMC-7455: Provide env map for discovered jolokia connections
>  - JMC-7455: Clean up some test comments
>  - JMC-7455: Ensure that jolokia version is set
>  - JMC-7455: Fix copy paste and outdated errors in Jolokia plugin manifest
>  - JMC-7455: Fixed whitespace of feature declaration
>  - JMC-7455: Fix copyright notices (change year) in Jolokia plugin
>  - JMC-7455: Fix rjmx imports after rebasing with master
>  - JMC-7455: Add plugin with support for Jolokia connections

Ok, so at least in JMC 7.1.0 and 8.3.0 this use to work by the fact that the plugin uses the extension point for JMX protocol: 
https://github.com/skarsaune/jmc/blob/e2c2275d05ee2e2215ea2a48b720ef2fef456810/application/org.openjdk.jmc.jolokia/plugin.xml#L43
However this no longer seems to work in 9.0.0 :(?). Does anyone know about particular changes in this area?

For instance when trying to connect to a JMC console from the JVM browser I get this:

`!ENTRY org.openjdk.jmc.console.ui 4 4 2024-02-04 17:14:27.250
!MESSAGE Could not connect to 127.0.0.1:8778 : Unsupported protocol: jolokia
!STACK 0
org.openjdk.jmc.rjmx.common.ConnectionException caused by java.net.MalformedURLException: Unsupported protocol: jolokia
	at org.openjdk.jmc.rjmx.common.internal.RJMXConnection.connect(RJMXConnection.java:364)
	at org.openjdk.jmc.rjmx.internal.ServerHandle.doConnect(ServerHandle.java:121)
	at org.openjdk.jmc.rjmx.internal.ServerHandle.connect(ServerHandle.java:111)
	at org.openjdk.jmc.console.ui.editor.internal.ConsoleEditor$ConnectJob.run(ConsoleEditor.java:99)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.net.MalformedURLException: Unsupported protocol: jolokia
	at java.management/javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:366)
	at org.openjdk.jmc.rjmx.common.internal.RJMXConnection.connectJmxConnector(RJMXConnection.java:591)
	at org.openjdk.jmc.rjmx.common.internal.RJMXConnection.establishConnection(RJMXConnection.java:572)
	at org.openjdk.jmc.rjmx.common.internal.RJMXConnection.connect(RJMXConnection.java:357)
	... 4 more
`

This appears to use Javas native JMXConnectorFactory directly . This may fail for a number of reasons:

1. Jolokia _does_ support service discovery, but only if the Jolokia library jar is on the classpath/same classsloader.
2. Furthermore this rules out providing a JMC specific connection that could allow us to put in optimizations for JMC.

Anyone know more about the setup of connections or how this may have changed recently.

-------------

PR Comment: https://git.openjdk.org/jmc/pull/548#issuecomment-1925822198


More information about the jmc-dev mailing list