A possible option is to use the QPID JMS driver - this is a v2.0 driver - with Active MQ v5. It uses AMQP to communicate with Active MQ instead of Openwire.
-----Original Message----- From: cooshal <kushal.gau...@gmail.com> Sent: 17 April 2019 08:32 To: users@activemq.apache.org Subject: Invoking JMS API with JMS 2.0, ActiveMQ and osgi (karaf) I have a scenario where I cannot switch to Artemis right now. And following up with several posts, I understood that it gets tricky for ActiveMQ to communicate with JMS 2.0. Because of some limitations in Jolokia api (https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Factivemq.2283324.n4.nabble.com%2FIs-it-possible-to-retrieve-more-than-400-messages-from-ActiveMQ-queue-via-Jolokia-API-td4750285.html&data=02%7C01%7Cdmartin%40sis.tv%7C399197d4959c4a74901608d6c3086dae%7C629ba906d77e4dc6acf3d71375b281ea%7C0%7C0%7C636910838304834479&sdata=oO%2Fikd2qhYKBx9Vy35gOVCVeDVn1mzwmZkfLFAG3zbs%3D&reserved=0), I switched to JMS API to browse my queues. This works perfectly fine and gave the intended results when deployed as an standalone application, as I have included activemq-client as one of the dependencies: <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-client</artifactId> <version>5.12.1</version> <type>jar</type> </dependency> I tried deploying similar implementation in Karaf, by creating connection factory as: ConnectionFactory connectionFactory = new ActiveMQConnectionFactory( "tcp://localhost:61616"); this failed because: 1. activemq-client requires JMS 1.x 2. my karaf container has JMS 2.0 Thus, I opted to use my pooled connection factory in the osgi bundle as: e.g. my blueprint configuration; where jms/consumer is already available in the service registry <reference id="jmsConnectionFactory" interface="javax.jms.ConnectionFactory" filter="(osgi.jndi.service.name=jms/consumer)" availability="mandatory" /> A fragment of my code in creating the connection is as: brokerConnection = connectionFactory.createConnection(); session = this.createSession(brokerConnection); brokerConnection.start(); until this point, brokerConnection and session are not null. Queue queue = session.createQueue("test.queue"); queueBrowser = session.createBrowser(queue); >From this point on, I get a NullPointerException as: java.lang.NullPointerException at org.apache.activemq.ActiveMQSession.createQueue(ActiveMQSession.java:1335) at org.apache.activemq.jms.pool.PooledSession.createQueue(PooledSession.java:197) at test.mbean.getBrokerEntries(BrokerMBean.java:142) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112) at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46) at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237) at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138) at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252) at javax.management.StandardMBean.invoke(StandardMBean.java:405) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.jolokia.handler.ExecHandler.doHandleRequest(ExecHandler.java:98) at org.jolokia.handler.ExecHandler.doHandleRequest(ExecHandler.java:40) at org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:89) at org.jolokia.backend.MBeanServerExecutorLocal.handleRequest(MBeanServerExecutorLocal.java:109) at org.jolokia.backend.MBeanServerHandler.dispatchRequest(MBeanServerHandler.java:159) at org.jolokia.backend.LocalRequestDispatcher.dispatchRequest(LocalRequestDispatcher.java:99) ... I am not sure what went wrong here. Any inputs would be very helpful. Thank you. -- Sent from: https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Factivemq.2283324.n4.nabble.com%2FActiveMQ-User-f2341805.html&data=02%7C01%7Cdmartin%40sis.tv%7C399197d4959c4a74901608d6c3086dae%7C629ba906d77e4dc6acf3d71375b281ea%7C0%7C0%7C636910838304834479&sdata=fuJLxX2DJZ%2BjJdvt1WrlLkof3E9MIXfOucgLCBBpIFQ%3D&reserved=0 ________________________________ Sports Information Services Limited. Registered Office: Whitehall Avenue, Kingston, Milton Keynes, Buckinghamshire, MK10 0AX. Company No. 4243307. The information in this email (which includes any files transmitted with it) is confidential and is intended for the addressee only. Unauthorized recipients are required to maintain confidentiality. If you have received this email in error please notify the sender immediately, destroy any copies and delete it from your computer system. ________________________________