Description
See the patch in the attachment that shows how to reproduce the issue.
The stacktrace:
jakarta.jms.JMSException: class org.apache.activemq.broker.region.DestinationFilter cannot be cast to class org.apache.activemq.broker.region.Topic (org.apache.activemq.broker.region.DestinationFilter and org.apache.activemq.broker.region.Topic are in unnamed module of loader 'app') at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:67)
at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1465)
at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1548)
at org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:568)
at org.apache.activemq.broker.virtual.CompositeQueueTest.testVirtualTopicCreation(CompositeQueueTest.java:59)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit.framework.TestCase.runTest(TestCase.java:177)
at junit.framework.TestCase.runBare(TestCase.java:142)
at org.apache.activemq.CombinationTestSupport.runBare(CombinationTestSupport.java:107)
at org.apache.activemq.CombinationTestSupport.runBare(CombinationTestSupport.java:113)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:130)
at junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit.framework.TestSuite.run(TestSuite.java:236)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: java.lang.ClassCastException: class org.apache.activemq.broker.region.DestinationFilter cannot be cast to class org.apache.activemq.broker.region.Topic (org.apache.activemq.broker.region.DestinationFilter and org.apache.activemq.broker.region.Topic are in unnamed module of loader 'app')
at org.apache.activemq.broker.region.virtual.SelectorAwareVirtualTopicInterceptor.<init>(SelectorAwareVirtualTopicInterceptor.java:44)
at org.apache.activemq.broker.region.virtual.VirtualTopic.intercept(VirtualTopic.java:57)
at org.apache.activemq.broker.region.virtual.VirtualDestinationInterceptor.intercept(VirtualDestinationInterceptor.java:57)
at org.apache.activemq.broker.region.CompositeDestinationInterceptor.intercept(CompositeDestinationInterceptor.java:38)
at org.apache.activemq.broker.region.AbstractRegion.addDestination(AbstractRegion.java:161)
at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:357)
at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:174)
at org.apache.activemq.advisory.AdvisoryBroker.addDestination(AdvisoryBroker.java:244)
at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:174)
at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:174)
at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:174)
at org.apache.activemq.broker.region.RegionBroker.send(RegionBroker.java:472)
at org.apache.activemq.broker.jmx.ManagedRegionBroker.send(ManagedRegionBroker.java:343)
at org.apache.activemq.advisory.AdvisoryBroker.fireAdvisory(AdvisoryBroker.java:936)
at org.apache.activemq.advisory.AdvisoryBroker.fireAdvisory(AdvisoryBroker.java:863)
at org.apache.activemq.advisory.AdvisoryBroker.fireAdvisory(AdvisoryBroker.java:858)
at org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker.java:125)
at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:99)
at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:99)
at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:99)
at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:854)
at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139)
at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:337)
at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:201)
at org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)
at org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:275)
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(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)