Hartmut Horrer created ARTEMIS-3841:
---------------------------------------
Summary: createConnectorService ClassCastException
Key: ARTEMIS-3841
URL: https://issues.apache.org/jira/browse/ARTEMIS-3841
Project: ActiveMQ Artemis
Issue Type: Bug
Components: Configuration, JMX, Web Console
Affects Versions: 2.22.0, 2.20.0
Environment: {{Linux xxxxx 5.17.6-1-MANJARO #1 SMP PREEMPT Mon May 9
07:52:43 UTC 2022 x86_64 GNU/L}}
{{openjdk 11.0.14 2022-01-18}}
{{OpenJDK Runtime Environment GraalVM CE 22.0.0.2 (build
11.0.14+9-jvmci-22.0-b05)}}
{{OpenJDK 64-Bit Server VM GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05,
mixed mode, sharing)}}
{{{}{}}}{{{}Apache ActiveMQ Artemis 2.22.0{}}}
{{ActiveMQ Artemis home: /home/hartmut/Programme/activemq-0}}
{{ActiveMQ Artemis instance: /home/hartmut/Programme/activemq-0/broker-0}}
Reporter: Hartmut Horrer
Attachments: Screenshot 2022-05-19 160154.png
h1. Problem with the createConnectorService() call via WebConsole or REST -
Jolokia
h2. Versions, we tested
- Artemis 2.20.0, 2.22.0
- Java 11
h2. The Problem
{quote}
Caused by: org.jolokia.client.exception.J4pRemoteException:
java.lang.ClassCastException : class
org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory
cannot be cast to class
org.apache.activemq.artemis.core.server.ConnectorServiceFactory
(org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory and
org.apache.activemq.artemis.core.server.ConnectorServiceFactory are in unnamed
module of loader java.net.URLClassLoader @4e9ba398)
at
org.jolokia.client.request.ValidatingResponseExtractor.extract(ValidatingResponseExtractor.java:63)
at org.jolokia.client.J4pClient.execute(J4pClient.java:195)
at org.jolokia.client.J4pClient.execute(J4pClient.java:168)
at org.jolokia.client.J4pClient.execute(J4pClient.java:117)
at
de.wilken.p5.fw.communication.impl.messaging.management.JolokiaManagementBean.execute(JolokiaManagementBean.java:577)
... 73 more
`
{quote}
*java.lang.ClassCastException :*
class
*org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory*
cannot be cast to
class *org.apache.activemq.artemis.core.server.ConnectorServiceFactory*
org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory and
org.apache.activemq.artemis.core.server.ConnectorServiceFactory are in unnamed
module of loader java.net.URLClassLoader @4e9ba398)
h2. Analysis
After a look in the Artemis source code we come to the following conclusion:
*
{{org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory}}
** implements
*** {{org.apache.activemq.artemis.spi.core.remoting.ConnectorFactory}}
** and not
*** {{org.apache.activemq.artemis.core.server.ConnectorServiceFactory}}
** ConnectorService which is created by the ConnectorServiceFactory is
deprecated!
*** is there an alternative way to add a connector via REST Jolokia API?
h2. Example (how it should work (,as I understand))
from Web Console:
{{createConnectorService(java.lang.String, java.lang.String, java.util.Map)}}
# test-connector
# org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory
# {"host": "127.0.0.1", "port": 61616}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)