Skip to main content

[JMS] destination to another application server

28 replies [Last post]
Anonymous

Hi. I have an EJB deployed on my machine running Glassfish v2. I want it to send messages to another server, that uses a different JMS implementation (JBoss), so that a MDB deployed on that remote application server processes my messages. I understand that I should somehow create a administered JMS object, destination, that points to the remote service. What I don't know is how do I specify this remote service in Glassfish. Also, I guess I need to add some additional JMS-client libraries, which contain the necessary classes to connect to that remote JMS service. I am not asking how to get hold of these libraries, just how do I specify a destination to such service.
Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chalava
Offline
Joined: 2008-03-13

Hi Ramesh,

What is the setup to connect JBossMq from glassfish V2. I knew that there is blog for JBoss messaging with Glassgish.

I followed same steps for JbossMQ, it didn't not worked out. Could you please let me know the steps and what are the libraries i have to provide to glassfish.

Thanks
Nanda

rampsarathy
Offline
Joined: 2005-11-23

Hi Nanda,
If you can post the problem (exception/error) you are facing , we can take it from there

-Ramesh

chalava
Offline
Joined: 2008-03-13

Hi Ramesh,

I am keepinig the secnario once again for ref.
I have a MDB running in Glassfish and Queue (jbossmq) running in remote server of jboss.
Here MDB has to consume msg from remote server of jbossmq.So, I have to setup remote connection in glassfish using generic RA.I follwed the steps which you have given for jboss messaging. I could not able to consume messages.

It may give you information. let me know if u need more information regardinig the issue

Thanks for reply.

Thanks
Nanda

rampsarathy
Offline
Joined: 2005-11-23

When you say "I could not able to consume messages."
Is there an exception/error in the GlassFish server.log ?
Is there an error in jboss mq log file ?
Which step of the instruction is failing ?
Did generic jms ra deployment succeed, was the mdb deployed properly ?

chalava
Offline
Joined: 2008-03-13

Hi Ramesh,

Did u see the log file which i have attached earlier msg.

I have deployed MDB successfully.
I have deployed Generic RA successfully.
I am getting error msg in glassfish log which i attached previous msg.
mean time i will also check jboss mq log. But do we really need to look into jboss mq log?

Thanks
Nanda

rampsarathy
Offline
Joined: 2005-11-23

hi Nanda,
i saw the log file, the only exception it has is unrelated to generic jms ra.
I also see the following statement
"[#|2009-01-15T12:09:27.407-0500|INFO|sun-appserver9.1|com.sun.genericjmsra|_ThreadID=172;_ThreadName=Thread-23838;|Generic resource adapter started consumption"

which seems to indicate that the consumer to the destination was created successfully. Can you check the Jboss MQ destination if it has a registered consumer.

-Ramesh

chalava
Offline
Joined: 2008-03-13

hi Ramesh,

Below message shows generic RA is binds with remote Queue name called QUEUE.MetadataImportXML. If i provide wrong queue to generic RA, will through an error like : there is no queue called queue/MetadataImportXML in remote server.
So it means generic RA can able to find queue in remote server.

[#|2009-01-21T12:58:25.850-0500|FINEST|sun-appserver9.1|com.sun.genericjmsra|_ThreadID=17;_ThreadName=Thread-94;ClassName=com.sun.genericra.util.ObjectBuilder;MethodName=build;_RequestID=a11d3cb6-2cf8-4e03-856e-2d4aa95e97d5;|Created the object based on class :org.jboss.mq.SpyQueue|#]
[#|2009-01-21T12:58:25.850-0500|FINEST|sun-appserver9.1|com.sun.genericjmsra|_ThreadID=17;_ThreadName=Thread-94;ClassName=com.sun.genericra.util.ObjectBuilder;MethodName=build;_RequestID=a11d3cb6-2cf8-4e03-856e-2d4aa95e97d5;|About to set properties on QUEUE.MetadataImportXML|#]

One more thing just want to confirm:
In your blog : http://weblogs.java.net/blog/rampsarathy/archive/2006/12/configuring_gla...
I have not run below command since i only have to consume message from remote server.I don't need to repost the message to anywhere.So, i thought i don't need this command to run.

Admin Objects
For JMS Destination Resources, an administered object needs to be created. In the image above, see jms/MyQueue [pointing to Generic JMS RA and TQueue] created in the application server.
#Creates a javax.jms.Queue Administered Object and binds it to application server's JNDI tree at jms/MyQueue and points to /queue/B
asadmin create-admin-object --raname genericra --restype javax.jms.Queue --property DestinationJndiName=/queue/B jms/OutQueue

Now i am not getting any error while redeploying the EAR. I am also attaching new log file.

I am also attaching my MDB to consume message from remote.

Even now i am not able to consume messages from remote server.Since i am not getting any errors i don't know how to move forward.

Can you give me some idea's where i could confirm all the steps i followed are correct?
And also conform me what are the steps i need to make sure setup which i did is correct?

-Nanda

rampsarathy
Offline
Joined: 2005-11-23

Hi Nanda,
when you say you are not able to consume messages, i guess it means there are messages in the Queue but the MDB is not being invoked, am i right ? We might not be able to generate any more debug information from the app server, we have to do it from the MQ provider.
Is there a way you can query the Queue destination in Jboss MQ and see how many messages are present, how many consumers and producers does it have ? In what transaction state the message is in. Iam sure there would be some JMX API for this. As i said before the first step is to confirm if the consumer is created for the queue, as per the server.log it is created, but you have to find out from JBoss MQ too, also if there is a way to turn on debug logging for Jboss MQ, you should do it.

-Ramesh

chalava
Offline
Joined: 2008-03-13

Hi Ramesh,

I have checked JBossMq to confirm Queue is created or not. it is created..
While deploying my project.ear if Queue is not available in remote server it will through an error saying that "No Queue.RAASRequestXML" available in remote server.So it means if Queue is not available in remote server your project itself won't deploy properly.

I also can see below messages in jboss server(remote):
chalava@jbosseserver:/ $ netstat -a | grep 1099 | grep 101.121
jbossserver.1099 101.121.41.411.2653 65161 0 50400 0 TIME_WAIT

chalava@jbossserver:/ $ netstat -a | grep 8093 | grep 101.121
jbossserver.8093 101.121.41.411.3320 65452 0 50400 0 ESTABLISHED
jbossserver.8093 101.121.41.411.3321 65352 0 50400 0 ESTABLISHED
jbossserver.8093 101.121.41.411.3322 65452 0 50400 0 ESTABLISHED
jbossserver.8093 101.121.41.411.3323 65452 0 50400 0 ESTABLISHED

it is saying that connection established with my ip address in jboss server.

to connect the jboss server it is using 1099 and to communicate objects back n forth it opened 8093.

So it is giving more clarity on connecting from glassfish to jboss is successful.

I hope there should be a problem in between my code and generic RA.

code: i have one MDB which is using ejb3 annotation to provide queue name.

please find attached files which i have to connect Generic RA.
and also i am sending snap shot which i created in glassfish app server.

-Nanda

chalava
Offline
Joined: 2008-03-13

Hi Ramesh,

I have downloaded Glassfish V2ur2 b60e and followed same steps for jboss messaging (your blog). i am getting any exception... i can see connection is established ..but i am not able to consume any message in glassfish(Jboss Queue already has message in queue).

I am wondering is Generic RA is compatible enough to consume messages? i understand that i can see log message like Generic RA is started consuming messages.. at the same time i also can see receivers count in jboss is showing zero. it means it is not actually connected to Queue.

I am wondering Are we proving enough of jboss libraries for JBossmq? your blog is showing for JBoss messaging... but not for Jbossmq...

Do we have to provide any other jboss libraries for JBossmq?

I am really having hard time to find and get this resolved...

rampsarathy
Offline
Joined: 2005-11-23

I dont think i will have an answer to your current problem, unless i try JbossMQ myself .

If you are using generic ra 2.0, just add "DeliveryType=Synchronous" (in the resource adapter config) and see if it works, you can download 2.0 from generic ra web site.

chalava
Offline
Joined: 2008-03-13

Hi Ramesh,

thanks a lot .. it worked after keeping DeliveryType.

- Nanda

chalava
Offline
Joined: 2008-03-13

Hi Ramesh,

do you aware of below error:

I just started glassfish v2b60e i am saw this error in server log.

javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException: org.omg.CORBA.INTERNAL: JTS5031: Exception [org.omg.CORBA.INTERNAL: vmcid: 0x0 minor code: 0 completed: Maybe] on Resource [rollback] operation. vmcid: 0x0 minor code: 0 completed: No
javax.transaction.SystemException: org.omg.CORBA.INTERNAL: JTS5031: Exception [org.omg.CORBA.INTERNAL: vmcid: 0x0 minor code: 0 completed: Maybe] on Resource [rollback] operation. vmcid: 0x0 minor code: 0 completed: No
at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:321)
at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:1003)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:398)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3817)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3596)
at com.sun.ejb.containers.MessageBeanContainer.afterMessageDeliveryInternal(MessageBeanContainer.java:1226)
at com.sun.ejb.containers.MessageBeanContainer.afterMessageDelivery(MessageBeanContainer.java:1197)
at com.sun.ejb.containers.MessageBeanListenerImpl.afterMessageDelivery(MessageBeanListenerImpl.java:79)
at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:139)
at $Proxy80.afterDelivery(Unknown Source)
at com.sun.genericra.inbound.sync.SyncJmsResource.releaseEndpoint(SyncJmsResource.java:168)
at com.sun.genericra.inbound.sync.SyncWorker.run(SyncWorker.java:178)
at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)

-Nanda

rampsarathy
Offline
Joined: 2005-11-23

you could share the file system (where jboss is installed) .
Or you can copy the jar files to a local directory and then use that in the classpath

bharas
Offline
Joined: 2008-12-19

Thanks for the reply..

how to set the provider URL in the Glassfish? as destination(topic) is on the another server?

my requirement is to subscribe to the weblogic server.

i have created MDB on glassfish and wanted to subscribe from this bean.

I appreciate for the help.

Thanks

rampsarathy
Offline
Joined: 2005-11-23

What resource adapter do you plan to use for this integration (Glassfish and Weblogic jms) ?

bharas
Offline
Joined: 2008-12-19

Thank you so much for the reply..

I am using NetBeans 6.5 for MDB (Glassfish).

bharas
Offline
Joined: 2008-12-19

i did it from weblogic to weblogic before in the following way.,.(in my earlier project)

@MessageDriven( maxBeansInFreePool = "1",
initialBeansInFreePool = "1",
defaultTransaction = MessageDriven.DefaultTransaction.NOT_SUPPORTED,
ejbName = "BillHistoryMsgBean",
destinationJndiName = "HSActionsTopic",
destinationType = "javax.jms.Topic",
durable = Constants.Bool.TRUE,
//durableSubscriptionDeletion = Constants.Bool.TRUE,
transactionType = MessageDriven.MessageDrivenTransactionType.CONTAINER,
acknowledgeMode = MessageDriven.AcknowledgeMode.AUTO_ACKNOWLEDGE,
jmsClientId = "LIS_DEV_BillHistoryMsgBean"

)

@MessageDestination(
name = "HSActionsTopic",
destinationJndiName = "HSActionsTopic",
providerUrl = "t3://xx.xx.xx.xxxx:8034"
)

@ForeignJmsProvider(
connectionFactoryJndiName = "ChartsConnectionFactory",
providerUrl = "t3://xx.xx.xx.xxxx:8034"
)

rampsarathy
Offline
Joined: 2005-11-23

if you want to deploy an MDB in GlassFish that will receive messages from a destination in WebLogic JMS server then you have to create the connector resources (connection factory, admin object.. HSActionsTopic and ChartsConnectionFactory in your code sample) using a Resource Adapter. The resource adapter has to be deployed and configured to connect to the WebLogic JMS server. You could use the resource adapter that WebLogic provides or a generic jms resource adaptor like Generic JMS RA (genericjmsra.dev.java.net).

bharas
Offline
Joined: 2008-12-19

Thanks ...

how to configure resource adapter to connect to the WebLogic JMS server?

chalava
Offline
Joined: 2008-03-13

Does anybody have idea on consuming messages from jbossmq?
i am using glassfish in my local and jbossmq is in remote.

i red the blog how to configure glassfish with jboss messging...

Are they same steps we have to use it to configure jbossmq also?

bharas
Offline
Joined: 2008-12-19

Hello Ram,

can you please let me know..how to configure resource adapter to connect to the WebLogic JMS server?

how to set the remote URL.

Thanks
Bhanu

rampsarathy
Offline
Joined: 2005-11-23

Hi Bhanu
i don't have a documentation with me for this, you have to try this yourself.
You can try the Jndi integration mode

-Ramesh

bharas
Offline
Joined: 2008-12-19

Thanks Ramesh

bharas
Offline
Joined: 2008-12-19

Hi,

If the JBOSS server is on the different machine then how will setup the classpath of the jar file you mentioned in the glassfish server that is on another machine?..

Thanks much

BS

bharas
Offline
Joined: 2008-12-19

adding in the previous question....

I am asking above in MDB.

how to set the provider URL in the Glassfish?

rampsarathy
Offline
Joined: 2005-11-23

Does the following link help, it shows how to consume messages in glassfish from a Jboss destination, what you need is the opposite for which you have to perform the initial setup (deploy generic ra, setup the classpath with jboss libraries..) and then create a connector resource and an admin object resource. Use these resources in your EJB.

http://weblogs.java.net/blog/rampsarathy/archive/2006/12/configuring_gla...

szczyp

Hi. This is very helpful, thank you for your answer. I will be able to take it from there.