Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
5.16.0
-
None
-
None
-
openjdk-1.8.0.252-2.b09
Payara 5
ActiveMQ 5.16.0
ActiveMQ 5.16.0 RAR installed as a connector on Payara
Classloader delegation disabled on glassfish-config.xml: <class-loader delegate="false"/>
-
Important
Description
Even if the ActiveMQ libraries are aligned with the 5.16.0 version, the TransportFactory raises a cast exception:
java.lang.ClassCastException: org.apache.activemq.transport.tcp.TcpTransportFactory cannot be cast to org.apache.activemq.transport.TransportFactory at org.apache.activemq.transport.TransportFactory.findTransportFactory
The class loader has the delegation disabled, but the connector has probably a separated classloader, so there could be some collision here.
I tried a workaround by providing activemq libraries as payara modules and using whitelist-package instructions on the glassfish-web.xml, like this...
<whitelist-package>org.apache.activemq</whitelist-package>
<whitelist-package>com.mysql</whitelist-package>
This solved this issue and the connector was pinging correctly, but everything else was broken in my project... as the whitelist-package has probably some other negative sides...
Same issue was available using the earlier activemq 5.15.9
Full stack of the exception is below:
[2020-08-20T15:01:27.300+0200] [Payara 5.2020] [BUONO] [] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator] [tid: _ThreadID=218 _ThreadName=controllerListener-1] [timeMillis: 1597928487300] [levelValue: 500] [CLASSNAME: com.sun.enterprise.resource.allocator.ConnectorAllocator] [METHODNAME: createResource] [[[2020-08-20T15:01:27.300+0200] [Payara 5.2020] [BUONO] [] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator] [tid: _ThreadID=218 _ThreadName=controllerListener-1] [timeMillis: 1597928487300] [levelValue: 500] [CLASSNAME: com.sun.enterprise.resource.allocator.ConnectorAllocator] [METHODNAME: createResource] [[ Resource Exception while creating resourcejavax.resource.ResourceException: Could not create connection. at org.apache.activemq.ra.ActiveMQManagedConnectionFactory.createManagedConnection(ActiveMQManagedConnectionFactory.java:210) at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:161) at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:920) at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1209) at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98) at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:287) at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1532) at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:957) at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:235) at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:528) at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:386) at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:244) at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:171) at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:354) at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:242) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166) at org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:95) at org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:67) at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180) at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:930) at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:901) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1079) at java.lang.Thread.run(Thread.java:748)Caused by: javax.jms.JMSException: Could not create Transport. Reason: javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Transport scheme NOT recognized: [tcp] at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36) at org.apache.activemq.ActiveMQSslConnectionFactory.createTransport(ActiveMQSslConnectionFactory.java:122) at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:346) at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:252) at org.apache.activemq.ra.ActiveMQConnectionSupport.makeConnection(ActiveMQConnectionSupport.java:89) at org.apache.activemq.ra.ActiveMQConnectionSupport.makeConnection(ActiveMQConnectionSupport.java:70) at org.apache.activemq.ra.ActiveMQManagedConnectionFactory.createManagedConnection(ActiveMQManagedConnectionFactory.java:208) ... 24 moreCaused by: javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Transport scheme NOT recognized: [tcp] at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36) at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:333) at org.apache.activemq.ActiveMQSslConnectionFactory.createTransport(ActiveMQSslConnectionFactory.java:120) ... 29 moreCaused by: java.io.IOException: Transport scheme NOT recognized: [tcp] at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:28) at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:185) at org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:64) at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:331) ... 30 moreCaused by: java.lang.ClassCastException: org.apache.activemq.transport.tcp.TcpTransportFactory cannot be cast to org.apache.activemq.transport.TransportFactory at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:182) ... 32 more