Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-9744

ActiveMQRAConnectionFactoryImpl fails to implement getReference()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • None

      ActiveMQRAConnectionFactoryImpl fails when being called on getReference():

      • it returns null
      • it displays an error message in the log

      this issue was discussed originally in https://camel.zulipchat.com/#narrow/channel/257302-camel-quarkus/topic/camel.20artemis.20with.20jca.20connector/near/494854318

      this is brining some noise into the camel app initialization.

      to reproduce :

      • create a new quarkus application: quarkus create app myapp
      • add extension quarkus-artemis-jms-ra
      • add imported boms as described in https://docs.quarkiverse.io/quarkus-artemis/dev/quarkus-artemis-ra.html#_installation 
      •  add the following properties: 
        quarkus.ironjacamar.ra.kind=artemis
        
        quarkus.ironjacamar.ra.config.connection-parameters=host=localhost;port=5445;protocols=CORE
        quarkus.ironjacamar.ra.config.user=guest
        quarkus.ironjacamar.ra.config.password=guest
        quarkus.ironjacamar.ra.config.client-id=Quarkus
        
        quarkus.ironjacamar.activation-spec.myqueue.config.destination-type=jakarta.jms.Queue
        quarkus.ironjacamar.activation-spec.myqueue.config.destination=jms.queue.MyQueue
        quarkus.ironjacamar.activation-spec.myqueue.config.max-session=2
        quarkus.ironjacamar.activation-spec.myqueue.config.rebalance-connections=true

        in the GreetingResource add the following code:

        @Inject
        @Identifier(Defaults.DEFAULT_RESOURCE_ADAPTER_NAME
        ConnectionFactory factory;
        ...
        @GET
        @Path("/ref")
        @Produces(MediaType.TEXT_PLAIN)
        public String ref()
        
         return "ref=" + ((ActiveMQRAConnectionFactoryImpl)factory).getReference();

      start the application with: mvn quarkus:dev
      try calling the endpoint: curl localhost:8080/hello/cf
      this will return ref=null, instead of a Reference object

      and the app log will show:

      2025-01-20 17:29:44,978 ERROR [org.apache.activemq.artemis.ra.ActiveMQRALogger] (executor-thread-2) AMQ154000: Error while creating object Reference.
      
      Exception in JMSResource.java:110
            108      @Produces(MediaType.TEXT_PLAIN)
            109      public String ref() {
          → 110          return "ref=" + ((ActiveMQRAConnectionFactoryImpl)factory).getReference();
            111      }
            112  }
      
      javax.naming.NamingException: Failed to serialize object:org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl@433756ed, org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManagerImpl
          at org.apache.activemq.artemis.ra.referenceable.SerializableObjectRefAddr.<init>(SerializableObjectRefAddr.java:55)
          at org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl.getReference(ActiveMQRAConnectionFactoryImpl.java:116)
          at com.x.myproduct.myapp.JMSResource.cf(JMSResource.java:110)
          at com.x.myproduct.myapp.JMSResource$quarkusrestinvoker$cf_61dff51ba123117b58ae69dd90953cc4e317284f.invoke(Unknown Source)
          at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
          at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
          at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
          at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:637)
          at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
          at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
          at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1591)
          at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
          at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
          at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
          at java.base/java.lang.Thread.run(Thread.java:1583)

      this should create a valid naming reference.

              rhn-support-jbertram Justin Bertram
              rh-messaging-ci Messaging CI
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: