Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 37680 invoked from network); 20 Jun 2006 07:40:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jun 2006 07:40:42 -0000 Received: (qmail 67291 invoked by uid 500); 20 Jun 2006 07:40:41 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 67267 invoked by uid 500); 20 Jun 2006 07:40:41 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 67258 invoked by uid 99); 20 Jun 2006 07:40:41 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2006 00:40:41 -0700 X-ASF-Spam-Status: No, hits=0.8 required=10.0 tests=INFO_TLD,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of james.strachan@gmail.com designates 66.249.92.172 as permitted sender) Received: from [66.249.92.172] (HELO ug-out-1314.google.com) (66.249.92.172) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2006 00:40:40 -0700 Received: by ug-out-1314.google.com with SMTP id m3so1181518uge for ; Tue, 20 Jun 2006 00:40:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RBaYewsoU/gCqKsnFl9cLQpGjZ17xEqGV6skwnOxcL52t4FW+ZY9M7iAO5ETwfenLCT3NaYUWINTp+aaQDQEo6RUJNAYBSF2X7spzFatspzhOi6hnz1wByex6u/tEZfuRyGVMNcDMuk8IL6u9mLJxgiiFjtnHBMcAJl+A9xt+DI= Received: by 10.67.15.3 with SMTP id s3mr6301598ugi; Tue, 20 Jun 2006 00:40:18 -0700 (PDT) Received: by 10.66.224.1 with HTTP; Tue, 20 Jun 2006 00:40:18 -0700 (PDT) Message-ID: Date: Tue, 20 Jun 2006 08:40:18 +0100 From: "James Strachan" To: activemq-users@geronimo.apache.org Subject: Re: NullPointerException with RA on Glassfish In-Reply-To: <4947362.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4947362.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N It looks like this exception... Caused by: java.lang.NullPointerException at org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:88) is caused by Glassfish calling ManagedConnectionFactory.createConnectionFactory(ConnectionManager manager) by passing in a null ConnectionManager. So it sounds like Glassfish is not creating a connection manager to use. This is only required if UseInboundSessionEnabled is not set. I've just updated SVN HEAD of ActiveMQ to throw a more descriptive error message if the JCA container does not configure a ConnectionManager. On 6/20/06, rhavyn wrote: > > Hello, > > I'm trying to get ActiveMQ 4.0 working with Glassfish using the JCA 1.5 RA. > I've deployed the RA and created a connection pool and queue. Sending > messages to a MDB works without a problem using a Stomp client (I haven't > tried a JMS client yet), however when I try and respond I'm getting a NPE > from within the createConnection call. The code to the MDB is: > > import javax.annotation.Resource; > import javax.ejb.ActivationConfigProperty; > import javax.ejb.MessageDriven; > import javax.ejb.MessageDrivenContext; > import javax.jms.Connection; > import javax.jms.ConnectionFactory; > import javax.jms.Destination; > import javax.jms.JMSException; > import javax.jms.Message; > import javax.jms.MessageListener; > import javax.jms.Session; > import javax.jms.TextMessage; > import javax.jms.MessageProducer; > import java.util.logging.Logger; > > @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = > "destination", > propertyValue = "queue"), @ActivationConfigProperty(propertyName = > "destinationType", > propertyValue = "javax.jms.Queue") }) > public class MDB implements MessageListener { > private static final Logger logger = Logger.getLogger("MDB"); > > @Resource > private MessageDrivenContext mdc; > > @Resource(mappedName = "jms/ConnectionFactory") > private ConnectionFactory connectionFactory; > > public void onMessage(Message message) { > Connection connection = null; > try { > if (message instanceof TextMessage) { > TextMessage msg = (TextMessage) message; > > logger.info("Message received: " + msg.getText()); > > connection = connectionFactory.createConnection(); > Session session = connection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > Destination destination = msg.getJMSReplyTo(); > MessageProducer producer = > session.createProducer(destination); > TextMessage response = session.createTextMessage(); > response.setText("Hello " + msg.getText()); > producer.send(response); > } > } catch (JMSException e) { > logger.warning("Error retrieving message: " + e); > mdc.setRollbackOnly(); > } finally { > if (connection != null) { > try { > connection.close(); > } catch (JMSException e) { > logger.warning("Exception while closing connection: " + > e); > } > } > } > } > } > > The log output is: > > [#|2006-06-19T17:14:58.179-0700|INFO|sun-appserver-pe9.1|MDB|_ThreadID=11;_ThreadName=p: > thread-pool-1; w: 2;|Message received: FOO BAR BAZ BUM i|#] > > [#|2006-06-19T17:15:09.111-0700|INFO|sun-appserver-pe9.1|javax.enterprise.system.container.ejb.mdb|_ThreadID=11;_ThreadName=p: > thread-pool-1; w: 2;mdb-1:MDB;javax.ejb.EJBException;|MDB00037: [mdb-1:MDB]: > Message-driven bean invocation exception: [javax.ejb.EJBException]|#] > > [#|2006-06-19T17:15:09.159-0700|INFO|sun-appserver-pe9.1|javax.enterprise.system.container.ejb.mdb|_ThreadID=11;_ThreadName=p: > thread-pool-1; w: 2;|javax.ejb.EJBException > javax.ejb.EJBException > at > com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3730) > at > com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3630) > at > com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431) > at > com.sun.ejb.containers.MessageBeanContainer.afterMessageDeliveryInternal(MessageBeanContainer.java:1112) > at > com.sun.ejb.containers.MessageBeanContainer.afterMessageDelivery(MessageBeanContainer.java:1083) > at > com.sun.ejb.containers.MessageBeanListenerImpl.afterMessageDelivery(MessageBeanListenerImpl.java:66) > at > com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:126) > at $Proxy18.afterDelivery(Unknown Source) > at > org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.afterDelivery(MessageEndpointProxy.java:125) > at > org.apache.activemq.ra.MessageEndpointProxy.afterDelivery(MessageEndpointProxy.java:64) > at > org.apache.activemq.ra.ServerSessionImpl.afterDelivery(ServerSessionImpl.java:214) > at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:751) > at > org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163) > at > com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:63) > at > com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479) > Caused by: java.lang.NullPointerException > at > org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:88) > at > org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:65) > at net.sourceforge.sfx.mdb.MDB.onMessage(MDB.java:42) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at > com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050) > at > com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165) > at > com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766) > at > com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847) > at > com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:997) > at > com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:61) > at > com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:166) > at $Proxy18.onMessage(Unknown Source) > at > org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:120) > at > org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60) > at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:692) > ... 3 more > |#] > > Any help would be greatly appreciated. > > Thanks so much, > --Chris > > -- > View this message in context: http://www.nabble.com/NullPointerException-with-RA-on-Glassfish-t1814940.html#a4947362 > Sent from the ActiveMQ - User forum at Nabble.com. > > -- James ------- http://radio.weblogs.com/0112098/