javaactivemq-classic

org.apache.activemq.util.IntrospectionSupport cannot access sun.security.ssl.SSLSocketImpl


I want to push some messages from my regression tests running on gitlab-runner to ActiveMQ Classic. I have all the necessary rules for that on the cluster. I followed this example, but I still received an exception. I'm using Java version Zulu17.34+19-CA (build 17.0.3+7-LTS) and org.apache.activemq.activemq-pool 5.15.1. My Java client config looks like that:

  ActiveMQConnectionFactory connectionFactory = new 
  ActiveMQConnectionFactory(prop("activeMQUrl"));
  connectionFactory.setUserName(prop("activeMQUser"));
  connectionFactory.setPassword(prop("activeMQPassword"));

  PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory();
  pooledConnectionFactory.setConnectionFactory(connectionFactory);
  pooledConnectionFactory.setMaxConnections(10);
  SimpleActiveMqProducer activeMq =
      new SimpleActiveMqProducer(pooledConnectionFactory,
          prop("activeMQUser"),
          prop("activeMQPassword"));
  activeMq
      .toQueue(prop("myQueue"))
      .send(objectToJson(myMessage))

properties:

myQueue=Consumer.my-consumer
activeMQUrl=failover:(nio+ssl://some.box.on.aws1:61617,nio+ssl://some.box.on.aws2:61617)?randomize=false&jms.optimizeAcknowledge=true&maxReconnectDelay=150&startupMaxReconnectAttempts=5
activeMQUser=root
activeMQPassword=root

Error:

15:39:20.861 [ActiveMQ Task-1] ERROR - Could not set property host on SSLSocket[hostname=null, port=0, Session(1689349160860|SSL_NULL_WITH_NULL_NULL)]
java.lang.IllegalAccessException: class org.apache.activemq.util.IntrospectionSupport cannot access class sun.security.ssl.SSLSocketImpl (in module java.base) because module java.base does not export sun.security.ssl to unnamed module @2dc9b0f5
    at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Unknown Source)
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.activemq.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:181)
    at org.apache.activemq.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:155)
    at org.apache.activemq.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:140)
    at org.apache.activemq.transport.tcp.SslTransport.(SslTransport.java:72)
    at org.apache.activemq.transport.tcp.SslTransportFactory.createTransport(SslTransportFactory.java:122)
    at org.apache.activemq.transport.TransportFactory.doCompositeConnect(TransportFactory.java:138)
    at org.apache.activemq.transport.TransportFactory.compositeConnect(TransportFactory.java:91)
    at org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:1011)
    at org.apache.activemq.transport.failover.FailoverTransport$2.iterate(FailoverTransport.java:148)
    at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133)
    at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Can someone help me with that?


Solution

  • You should use the latest ActiveMQ Classic client dependencies which are 5.18.2 at this point. Version 5.15.1 (which you are using now) was released almost 6 years ago now in September, 2017. I don't believe it supports running on JDK 17.