Deployment of custom MBean causes java.net.MalformedURLException: Unsupported protocol: remote+http in JBoss EAP 7.3.0 and later
Issue
When deploying the following custom MBean code, deployment succeeds up to JBoss EAP 7.2.9 but fails for 7.3.0 and later (including 7.4).
public class ConfigService extends ServiceMBeanSupport implements ConfigServiceMBean {
private static final String JMX_URL = "service:jmx:remote+http://127.0.0.1:9990";
@Override
protected void startService() throws Exception {
JMXServiceURL serviceURL = new JMXServiceURL(JMX_URL);
try (JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, null)) { // java.net.MalformedURLException: Unsupported protocol: remote+http on JBoss EAP 7.3.0 or later, but it works up to 7.2.9
MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
...
Log of reproduction:
16:12:11,980 WARN [org.jboss.example.mbean.support.ConfigService] (MSC service thread 1-4) WFLYSYSJMX0006: Starting failed jboss.support:name=ConfigBean: java.net.MalformedURLException: Unsupported protocol: remote+http
at java.management/javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:366)
at java.management/javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:269)
at deployment.SampleMBean.sar//org.jboss.example.mbean.support.ConfigService.startService(ConfigService.java:22)
at org.jboss.as.system-jmx@7.4.13.GA-redhat-00001//org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:255)
...
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.3
- 7.4
- 8.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.