smallrye / smallrye-reactive-messaging

SmallRye Reactive Messaging
http://www.smallrye.io/smallrye-reactive-messaging/
Apache License 2.0
233 stars 174 forks source link

Unable to establish JMS Connection Factory context with smallrye-jms #1831

Open neeleym opened 2 years ago

neeleym commented 2 years ago

I am attempting to use smallrye-jms to send Kogito ProcessEvents to an ActiveMQ JMS topic. I am following the smallrye-jms documentation found here: [https://smallrye.io/smallrye-reactive-messaging/smallrye-reactive-messaging/3.4/jms/jms.html]

I understand that the smallrye-jms connector needs a ConnectionFactory either named as a property or exposed via CDI. I am using the same example as shown in the documentation to expose a ConnectionFactory. Since it is a ActiveMQJMSConnectionFactory , I am including the following dependency:

<dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-jms-client</artifactId>
      <version>2.23.1</version>
</dependency>

My properties to support the Quarkus service are as follows:

quarkus.artemis.url=tcp://localhost:61616
# quarkus.qpid-jms.url=amqp://localhost:5672

mp.messaging.outgoing.kogito-processinstances-events.connector=smallrye-jms
mp.messaging.outgoing.kogito-processinstances-events.destination-type=topic
mp.messaging.outgoing.kogito-processinstances-events.topic=kogito-processinstances-events

mp.messaging.outgoing.kogito-usertaskinstances-events.connector=smallrye-jms
mp.messaging.outgoing.kogito-usertaskinstances-events.destination-type=topic
mp.messaging.outgoing.kogito-usertaskinstances-events.topic=kogito-usertaskinstances-events

mp.messaging.outgoing.kogito-variables-events.connector=smallrye-jms
mp.messaging.outgoing.kogito-variables-events.destination-type=topic
mp.messaging.outgoing.kogito-variables-events.topic=kogito-variables-events

When building and running the Quarkus service, I get the following:

Caused by: java.lang.NoSuchMethodError: 'javax.jms.JMSContext javax.jms.ConnectionFactory.createContext(int)'
        at io.smallrye.reactive.messaging.jms.JmsConnector.createContext(JmsConnector.java:210)
        at io.smallrye.reactive.messaging.jms.JmsConnector.createJmsContext(JmsConnector.java:137)
        at io.smallrye.reactive.messaging.jms.JmsConnector.getSubscriberBuilder(JmsConnector.java:148)
        at io.smallrye.reactive.messaging.jms.JmsConnector_Subclass.getSubscriberBuilder$$superforward1(Unknown Source)
        at io.smallrye.reactive.messaging.jms.JmsConnector_Subclass$$function$$5.apply(Unknown Source)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:53)
        at io.quarkus.smallrye.reactivemessaging.runtime.DuplicatedContextConnectorFactoryInterceptor.intercept(DuplicatedContextConnectorFactoryInterceptor.java:39)
        at io.quarkus.smallrye.reactivemessaging.runtime.DuplicatedContextConnectorFactoryInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:40)
        at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
        at io.smallrye.reactive.messaging.jms.JmsConnector_Subclass.getSubscriberBuilder(Unknown Source)
        at io.smallrye.reactive.messaging.jms.JmsConnector_ClientProxy.getSubscriberBuilder(Unknown Source)
        at io.smallrye.reactive.messaging.providers.impl.ConnectorFactories.lambda$wrap$5(ConnectorFactories.java:84)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.createSubscriber(ConfiguredChannelFactory.java:189)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.register(ConfiguredChannelFactory.java:144)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.initialize(ConfiguredChannelFactory.java:105)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory_ClientProxy.initialize(Unknown Source)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
        at io.smallrye.reactive.messaging.providers.extension.MediatorManager.start(MediatorManager.java:200)
        at io.smallrye.reactive.messaging.providers.extension.MediatorManager_ClientProxy.start(Unknown Source)
        at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:41)
        at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_7f54e4b27c1b49e5e062caa58f1e82797fa01393.notify(Unknown Source)
        at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:323)
        at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:305)
        at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:73)
        at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:130)
        at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:99)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
        ... 52 more

The glaring exception being:

Caused by: java.lang.NoSuchMethodError: 'javax.jms.JMSContext javax.jms.ConnectionFactory.createContext(int)'
        at io.smallrye.reactive.messaging.jms.JmsConnector.createContext(JmsConnector.java:210)

I have also attempted to implement this with the Qpid JMS client and got the same exact result with the java.lang.NoSuchMethodError and the same line of smallrye-jms code for the createContext call.

So, I am looking for advice as to where the disconnect is. Do you have any ideas as to where I might look next for troubleshooting this issue?

Using: Kogito 1.23 Quarkus 2.10.3 Final smallrye-jms 3.18.0 ActiveMQ 5

Thanks

cescoffier commented 1 year ago

There is probably a version mismatch. Not that the smallrye JMS connector is not supported in Quarkus (and totally untested in this context).