Solving Unsupported protocol: remote+http
This article shows how to fix the error “Unsupported protocol: remote+http” which can happen if you try to connect via JMX to a java process, such as JBoss/WildFly application server.
In some cases, the JMX subsystem registers a service with the Remoting endpoint so that you can obtain remote access to JMX over the exposed Remoting connector. This is the case of a JMX Connection String such as the following one:
service:jmx:remote+http://localhost:9990
Here is an example code snipped which connects to WildFly via JMX through the port 9990:
String host = "localhost";
int port = 9990; // management-http port
String urlString = "service:jmx:remote+http://" + host + ":" + port;
System.out.println("\n\n\t**** urlString: "+urlString);;
JMXServiceURL serviceURL = new JMXServiceURL(urlString);
Map map = new HashMap();
String[] credentials = new String[] { "admin", "admin" };
map.put("jmx.remote.credentials", credentials);
JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, map);
If you run the above example, without any extra dependency, you will hit the following error:
Exception in thread "main" java.net.MalformedURLException: Unsupported protocol: remote+http
at java.management/javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:366)
This is because, to run JMX over RMI you need to include the wildfly-client-all dependency for your server version. For example:
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-client-all</artifactId>
<version>26.0.0.Final</version>
</dependency>
To learn more about WildFly and JMX, check this article: Managing MBeans with WildFly
Recommended Articles
Discover WildFly / JBoss Cluster Members with CLI, JConsole, and JMX
Learn how to discover your WildFly/JBoss cluster members using CLI, JConsole, and JMX. #WildFly #JMX #ClusterManagement
Mastering WildFly Management API through HTTP and JSON - A Comprehensive Guide
Learn how to access WildFly's management interface via HTTP and JSON. Discover advantages and use cases. #WildFly #Java #CloudNative
Install and Use WildFly Core as Management Interface for Remote Servers
Learn how to install and utilize WildFly core as a management interface for remote WildFly servers, including installation via Galleon and using the CLI.
Resolve WFLYJCA0047 Error in WildFly: A Step-by-Step Troubleshooting Guide
Troubleshoot and fix the WFLYJCA0047 error in WildFly. Learn how to resolve JDBC, SSL, and pool configurations issues.