users@glassfish.java.net

Re: MDB that receives from ActiveMQ example

From: <glassfish_at_javadesktop.org>
Date: Fri, 23 Jan 2009 09:08:09 PST

Very nice example - Thanks!

Is it possible to post to the ActiveMQ queue/topic through Glassfish? I tried it using:
---------------------------------------------------------------------------------------
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
env.put("org.omg.CORBA.ORBInitialPort", "3700");
env.put("org.omg.CORBA.ORBInitialHost", "localhost");

env.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
env.put("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");


Context ic = new InitialContext(env);

connectionFactory = (ConnectionFactory)(ic.lookup("jms/ActiveFactory"));

Connection connection = connectionFactory.createConnection();

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

queue = (Queue) ic.lookup("jms/ActiveQueue");
System.out.println("Queue = " + queue);
---------------------------------------------------------------------------------

I received the following:

Queue = queue://null


java.lang.NullPointerException
        at org.apache.activemq.command.ActiveMQDestination.hashCode(ActiveMQDestination.java:296)
        at java.util.HashMap.get(HashMap.java:300)
        at org.apache.activemq.openwire.OpenWireFormat.getMarshallCacheIndex(OpenWireFormat.java:481)
        at org.apache.activemq.openwire.v2.BaseDataStreamMarshaller.tightMarshalCachedObject1(BaseDataStreamMarshaller.java:145)
        at org.apache.activemq.openwire.v2.ProducerInfoMarshaller.tightMarshal1(ProducerInfoMarshaller.java:97)
        at org.apache.activemq.openwire.OpenWireFormat.marshal(OpenWireFormat.java:228)
        at org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:118)
        at org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor.java:141)
        at org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:80)
        at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:93)
        at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:43)
        at org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
        at org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1151)
        at org.apache.activemq.ActiveMQSession.asyncSendPacket(ActiveMQSession.java:1648)
        at org.apache.activemq.ActiveMQMessageProducer.<init>(ActiveMQMessageProducer.java:100)
        at org.apache.activemq.ActiveMQSession.createProducer(ActiveMQSession.java:776)
        at org.apache.activemq.ra.ManagedSessionProxy.createProducer(ManagedSessionProxy.java:225)
        at sender.main(sender.java:66)

Any suggestions?
[Message sent by forum member 'janchj' (janchj)]

http://forums.java.net/jive/thread.jspa?messageID=327875