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 (http://activemq.2283324.n4.nabble.com/Is-it-possible-to-retrieve-more-than-400-messages-from-ActiveMQ-queue-via-Jolokia-API-td4750285.html), 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: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html