users@glassfish.java.net

Re: [Fwd: iiop over http] GF v2 b36 + ActiveMQ 4.1

From: Ramesh Parthasarathy <Ramesh.Parthasarathy_at_Sun.COM>
Date: Wed, 21 Feb 2007 04:08:37 +0000

Hi David,

        The integration modes of EMBEDDED or REMOTE (or LOCAL) indicate the
ways in which the GlassFish manages the lifecycle of the bundled Sun
Java System Message Queue broker 4.1. These do not apply for other third
party JMS providers like Active MQ.

If you want to use ActiveMQ with GlassFish , you have 2 options :

1. Use the Active MQ RA, But, the resource adapater of Active MQ has an
associated issue, iam not sure if this is fixed yet,
https://issues.apache.org/activemq/browse/AMQ-765

2. You could use the generic jms resource adapter
(https://genericjmsra.dev.java.net) to integrate GlassFish with ActiveMQ.
We have user guides which describe the integration of various JMS
providers with GlassFish, Please take a look at the user guide and also
other integration guides.

You have to do the following steps , and please let us know if you have
any issues.

1. You have to include the Active MQ JMS client libraries in the
GlassFish server classpath-suffix (can be done through admin console)
activemq-optional-3.2.1.jar
derby-10.0.2.1.jar
activecluster-1.1-SNAPSHOT.jar
activemq-ra-3.2.1.jar
activeio-1.1.jar
commons-logging-1.0.3.jar
spring-1.2.2.jar
activemq-core-3.2.1.jar
concurrent-1.3.4.jar
xstream-1.1.2.jar



2. Create the resource adapter configuration for Generic RA
using javabean integration mode and following values.


XAConnectionFactoryClassName
org.activemq.ActiveMQXAConnectionFactory

XAQueueConnectionFactoryClassName
org.activemq.ActiveMQXAConnectionFactory

XATopicConnectionFactoryClassName
org.activemq.ActiveMQXAConnectionFactory

        connectionFactoryClassName
org.activemq.ActiveMQConnectionFactory

        connectionFactoryProperties
brokerURL=tcp://localhost:61616

        providerIntegrationMode javabean

        queueClassName
org.activemq.message.ActiveMQQueue

        queueConnectionFactoryClassName
org.activemq.ActiveMQConnectionFactory

        supportsXA true

        topicClassName
org.activemq.message.ActiveMQTopic

        topicConnectionFactoryClassName
org.activemq.ActiveMQConnectionFactory


3. Deploy the Generic RA rar file :
present under
GLASSFISH/lib/addons/resourceadapters/genericjmsra/genericra.rar

4. Create connector connection pools, connection factories and
administered objects in GF.

PLease remember that when creating the pool you have to specify the ra
name as genericra.

5. Configure the sun-ejb-jar.xml with the activation spec properties.
Follow the generic jms ra user guide.You cannot do this with
annotations, you have to edit the dd if you want to use a custom
resource adapter.

Let me know of you need more information, or you run into any issues.

Thanks
-Ramesh


David Harrigan wrote On 02/20/07 22:48,:
> Hi,
>
> I've put that in now.
>
> I removed the reference in GF to the EMBEDDED broker and put in Remote,
> creating a new jms host to point to localhost on port 61616 (activemq
> default tcp port). I then removed the default-jms-host and assigned the
> value to be activemq (the name of my new host with the activemq settings).
>
> Now, when I start up GF, it gives me connection refused....so, I start up
> ActiveMQ and this is what I get:
>
> [#|2007-02-20T22:43:55.488+0000|INFO|sun-appserver9.1|javax.enterprise.resource.resourceadapter|_ThreadID=10;_ThreadName=main;|JMS
> Service Connection URL is :mq://localhost:61616/|#]
>
> [#|2007-02-20T22:43:55.492+0000|INFO|sun-appserver9.1|javax.resourceadapter.mqjmsra.lifecycle|_ThreadID=10;_ThreadName=main;|MQJMSRA_RA1101:
> SJSMQ JMS Resource Adapter starting...
> ================================================================================
> Sun Java(tm) System Message Queue 4.1
> Sun Microsystems, Inc.
> Version: 4.1 Dev (Build 22-g)
> Compile: Fri Jan 19 12:12:49 PST 2007
>
> Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
> SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
>
> This product includes code licensed from RSA Data Security.
> ================================================================================
> |#]
>
> [#|2007-02-20T22:44:10.517+0000|WARNING|sun-appserver9.1|javax.jms|_ThreadID=10;_ThreadName=main;_RequestID=043625f5-7bbf-4fb0-9342-5dff8e3fd146;|[I500]:
> Caught JVM Exception: java.lang.NumberFormatException: For input string:
> "�ActiveMQ�"|#]
>
> [#|2007-02-20T22:44:30.534+0000|WARNING|sun-appserver9.1|javax.jms|_ThreadID=10;_ThreadName=main;_RequestID=043625f5-7bbf-4fb0-9342-5dff8e3fd146;|[I500]:
> Caught JVM Exception: java.lang.NumberFormatException: For input string:
> "�ActiveMQ�"|#]
>
> [#|2007-02-20T22:44:50.551+0000|WARNING|sun-appserver9.1|javax.jms|_ThreadID=10;_ThreadName=main;_RequestID=043625f5-7bbf-4fb0-9342-5dff8e3fd146;|[I500]:
> Caught JVM Exception: java.lang.NumberFormatException: For input string:
> "�ActiveMQ�"|#]
>
> [#|2007-02-20T22:45:10.566+0000|WARNING|sun-appserver9.1|javax.jms|_ThreadID=10;_ThreadName=main;_RequestID=043625f5-7bbf-4fb0-9342-5dff8e3fd146;|[I500]:
> Caught JVM Exception: java.lang.NumberFormatException: For input string:
> "�ActiveMQ�"|#]
>
>
>
> The weird symbols are being output on the trace. ActiveMQ is also
> complaining:
>
> INFO TransportServerThreadSupport - Listening for connections at:
> tcp://piccolino:61616
> INFO TransportConnector - Connector openwire Started
> INFO TransportServerThreadSupport - Listening for connections at:
> ssl://piccolino:61617
> INFO TransportConnector - Connector ssl Started
> INFO TransportServerThreadSupport - Listening for connections at:
> stomp://piccolino:61613
> INFO TransportConnector - Connector stomp Started
> INFO NetworkConnector - Network Connector default-nc Started
> INFO BrokerService - ActiveMQ JMS Message Broker
> (localhost, ID:piccolino-35643-1172011326777-1:0) started
> DEBUG WireFormatNegotiator - Sending: WireFormatInfo { version=2,
> properties={CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false,
> TcpNoDelayEnabled=true, MaxInactivityDuration=30000,
> TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
> DEBUG Transport - Transport failed:
> java.io.IOException: Wire format negociation timeout: peer did not send his
> wire format.
> java.io.IOException: Wire format negociation timeout: peer did not send his
> wire format.
> at
> org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:88)
> at
> org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:43)
> at
> org.apache.activemq.broker.TransportConnection.dispatch(TransportConnection.java:1051)
> at
> org.apache.activemq.broker.TransportConnection.processDispatch(TransportConnection.java:779)
> at
> org.apache.activemq.broker.TransportConnection.start(TransportConnection.java:818)
> at
> org.apache.activemq.broker.TransportConnector$1.onAccept(TransportConnector.java:148)
> at
> org.apache.activemq.transport.tcp.TcpTransportServer.run(TcpTransportServer.java:167)
> at java.lang.Thread.run(Thread.java:619)
> DEBUG TransportConnection - Stopping connection: /127.0.0.1:49459
> DEBUG TransportConnection - Stopped connection: /127.0.0.1:49459
>
>
>
>
> YOu know, I find it funny that both ActiveMQ and GF mention that they work
> together. I've found no instructions on how to configure them to work
> together - I'm trying to figure this out myself and not getting very far. I
> wish it was just Plug'n'Play....
>
> (http://activemq.apache.org/ for a reference to GF in it's Features - yet
> nothing on GF - just JBoss and Geronimo).
>
>
> -=david=-
>
>
> Daniel Cavalcanti wrote:
>
>>One of many possible points that I see is that you need to start the
>>connection so that the mssages get delivered, i.e. connection.start();
>>probably before you created the producer.
>>
>>On 2/20/07, David Harrigan <dharrigan_at_gmail.com> wrote:
>>
>>>
>>>Hi,
>>>
>>>I'm trying out the latest (and greatest) GF with ActiveMQ 4.1. I've
>>>downloaded the Resource Adapter for ActiveMQ which conforms to the JCA
>>>1.5
>>>spec.
>>>
>>>* Deployed the RA in GF - no problem.
>>>* Created a Connector Connection Pool called jms/connectionPool
>>>* Created a Connector Resource called jms/connectionFactory configured to
>>>use jms/connectionPool
>>>* Created Admin Object Resource called jms/testQueue with name of
>>>testQueue
>>>* Under Physical Destinations in Configuration -> Java Message Service
>>>created a testQueue
>>>
>>>My client (producer) looks like this (stripped of ilrelevant code):
>>>
>>> @Resource(mappedName="jms/connectionFactory")
>>> private static ConnectionFactory connectionFactory;
>>>
>>> @Resource(mappedName="jms/testQueue")
>>> private static Queue queue;
>>>
>>> private void doIt() throws Exception {
>>> final Connection connection = connectionFactory.createConnection
>>>();
>>> final Session session = connection.createSession(false,
>>>Session.AUTO_ACKNOWLEDGE);
>>> final MessageProducer messageProducer =
>>>session.createProducer(queue);
>>> TextMessage textMessage = session.createTextMessage("Hello World!
>>>");
>>> messageProducer.send(textMessage);
>>> connection.close();
>>> }
>>>
>>>My consumer (my Message Driven Bean) looks like this:
>>>
>>>@MessageDriven(mappedName = "jms/testQueue")
>>>public class MessageBean {
>>>
>>> @Resource MessageDrivenContext messageDrivenContext;
>>>
>>> public void onMessage(final Message message) {
>>> final TextMessage textMessage = (TextMessage)message;
>>> try {
>>> System.out.println("Received this message : " +
>>>textMessage.getText());
>>> } catch (final JMSException e) {
>>> e.printStackTrace();
>>> }
>>> }
>>>}
>>>
>>>Now, her e comes the interesting part:
>>>
>>>When I execute my App using this:
>>>
>>>./appclient -client
>>>/home/david/javastuff/eclipse-3.2.1/workspace/jee5/dist/jmsclient.jar
>>>
>>>I get output in the server.log
>>>
>>>BUT and this is a big BUT!!
>>>
>>>I haven't started ActiveMQ on my system! It's not even running anywhere!
>>>
>>>I'm at a loss as why this is happening (I've deleted (I think - looks
>>>like
>>>that in the web console)) any reference to jmsra.
>>>
>>>
>>>Anyone with any idea?
>>>
>>>
>>>-=david=-
>>>--
>>>View this message in context:
>>>http://www.nabble.com/GF-v2-b36-%2B-ActiveMQ-4.1-tf3263484.html#a9071269
>>>Sent from the java.net - glassfish users mailing list archive at
>>>Nabble.com.
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>>
>>
>>
>