JMS Reader exception connecting to JBoss messaging queue

Hi,

I am trying to create a JMS Reader to read messages from a queue defined in my JBoss server 5.1 GA

JMS config -
name=
destId=queue/TestQueue
username=guest
providerUrl=jnp\://hostIP\:1099
connectionFactory=ConnectionFactory
libraries=/opt/GateIn-3.1.0/client/jboss-logging-spi.jar;/opt/GateIn-3.1.0/client/jboss-messaging-client.jar;/opt/GateIn-3.1.0/client/jboss-mdr.jar;/opt/GateIn-3.1.0/client/jboss-aop-client.jar
iniCtxFactory=org.jnp.interfaces.NamingContextFactory
password=guest

Following is the error stack trace when executing the graph.

ERROR [WatchDog] - Graph pre-execute initialization failed.
Element [1315455928228:JMSINF]-Pre-Execution of connection [JmsConnection0] failed.
at org.jetel.graph.TransformationGraph.preExecute(TransformationGraph.java:484)
at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:196)
at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:64)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.lang.Thread.run(Thread.java:636)
Caused by: Cannot establish JMS connection (null)
at org.jetel.connection.jms.JmsConnection.initConnection(JmsConnection.java:395)
at org.jetel.connection.jms.JmsConnection.preExecute(JmsConnection.java:359)
at org.jetel.graph.TransformationGraph.preExecute(TransformationGraph.java:481)

I wrote a client java program in eclipse and executed it to create and send a message. It worked without issues.

Java test program -

queue = (Queue)JNDIHelper.getReference(“queue/TestQueue”);
connFactory = (ConnectionFactory)JNDIHelper.getReference(“ConnectionFactory”);
Connection connection = connFactory.createConnection(“guest”, “guest”);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

MessageProducer producer = session.createProducer(queue);
MessageConsumer consumer = session.createConsumer(queue);
connection.start();
TextMessage message = session.createTextMessage(“This is a test message.”);
producer.send(message);

Please help me debug this issue. Is there some configuration that I am missing for connecting to the server?

Hello,
Is it the whole error message? Try to run the graph without checking the configuration (-skipcheckcofig option), then full error stack trace should be printed out.
I was able to create a JMSconnection within the same jvm in Jboss, but I was not able to connect from a standalone client (CloverETL Designer).
If you are able to write a valid connection in java, you can create your JMS connection object that overrides org.jetel.connection.jms.JmsConnection and integrate it to your CloverETL:

  • Write object overriding org.jetel.connection.jms.JmsConnection - you need to override init() and preExecute() methods

  • write plugin.xml file (see attached file: this is plugin description file for org.jetel.connection standard plugin)

  • place the plugin.xml and your binaries to CloverETL plugin directory (something like <cloveretl_designer_home_directory>/plugins/com.cloveretl.gui_X.X.X/lib/plugins

  • plugin.xml

Here is the full stack trace with -skipcheckconfig option

ERROR [WatchDog] - Graph pre-execute initialization failed.
Element [1315455928228:JMSINF]-Pre-Execution of connection [JmsConnection0] failed.
at org.jetel.graph.TransformationGraph.preExecute(TransformationGraph.java:484)
at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:196)
at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:64)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.lang.Thread.run(Thread.java:636)
Caused by: Cannot establish JMS connection (null)
at org.jetel.connection.jms.JmsConnection.initConnection(JmsConnection.java:395)
at org.jetel.connection.jms.JmsConnection.preExecute(JmsConnection.java:359)
at org.jetel.graph.TransformationGraph.preExecute(TransformationGraph.java:481)
… 5 more
Caused by: org.jboss.jms.exception.MessagingNetworkFailureException
at org.jboss.jms.client.delegate.DelegateSupport.handleThrowable(DelegateSupport.java:263)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$createConnectionDelegate$aop(ClientConnectionFactoryDelegate.java:191)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate$createConnectionDelegate_N3019492359065420858.invokeTarget(ClientConnectionFactoryDelegate$createConnectionDelegate_N3019492359065420858.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
at org.jboss.jms.client.container.StateCreationAspect.handleCreateConnectionDelegate(StateCreationAspect.java:81)
at org.jboss.aop.advice.org.jboss.jms.client.container.StateCreationAspect_z_handleCreateConnectionDelegate_22948154.invoke(StateCreationAspect_z_handleCreateConnectionDelegate_22948154.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createConnectionDelegate(ClientConnectionFactoryDelegate.java)
at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:205)
at org.jboss.jms.client.JBossConnectionFactory.createConnection(JBossConnectionFactory.java:87)
at org.jetel.connection.jms.JmsConnection.initConnection(JmsConnection.java:393)
… 7 more
Caused by: org.jboss.remoting.InvocationFailureException: Unable to perform invocation; nested exception is:
java.io.IOException: org.jboss.remoting.InvocationResponse
at org.jboss.remoting.transport.socket.SocketClientInvoker.handleException(SocketClientInvoker.java:142)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:891)
at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.transport(BisocketClientInvoker.java:426)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
at org.jboss.remoting.MicroRemoteClientInvoker.establishLease(MicroRemoteClientInvoker.java:467)
at org.jboss.remoting.Client.setupClientLease(Client.java:1715)
at org.jboss.remoting.Client.connect(Client.java:1615)
at org.jboss.remoting.Client.connect(Client.java:515)
at org.jboss.jms.client.remoting.JMSRemotingConnection$1.run(JMSRemotingConnection.java:354)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.jms.client.remoting.JMSRemotingConnection.start(JMSRemotingConnection.java:350)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$createConnectionDelegate$aop(ClientConnectionFactoryDelegate.java:158)
… 16 more
Caused by: java.io.IOException: org.jboss.remoting.InvocationResponse
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:179)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at org.jboss.jms.wireformat.SerializedPacket.read(SerializedPacket.java:73)
at org.jboss.jms.wireformat.JMSWireFormat.read(JMSWireFormat.java:298)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:1222)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:850)
… 26 more

I’ve got the same stack trace :-(. It seems, that it is impossible to connect to remote JMS queue on Jboss, with java sun api (Getting Started with Java Message Service (JMS)). But if you are able to write the working connection it is easy to integrate it to CloverETL (similar as Step by Step Component building). You can download java source of CloverETL (with org.jetel.connection.jms.JmsConnection) from Sourceforge.

Is this a limitation or bug with Desktop edition?
Will the remote JMS connection work with the Server Edition? or Should I go ahead and use the custom code for JMSConnection and use that?

Hi Agata,

I was looking over the source code and the line number where the exception was being thrown. Looks to me that the factory object used in the initConnection() method might be null and it is not getting created.
I was also wondering as to why the init() method is not called and instead the initConnection() method is called. If init() method was called prior to creating the connection, we might be able to see initial context, factory object and other variables initialized.

Could you please help me understand if I am reading the code wrong or is there something missing as to how it is called or instantiated?

Hello,
I’ve tested the CLoverETL JMS connection on CloverETL Server on Jboss 5.1. It worked fine, when I sent/read messages from the Queue defined on the same application server, but I was not able to connect from stand alone CloverETL Designer. I’ve googled a lot, but haven’t found a solution. I’ll try to search more.
If you would like to try CloverETL Server please write to sales@cloveretl.com. You can get a trial version for one month.

Hello,
init() method of org.jetel.connection.jms.JmsConnection is called from init() method of org.jetel.graph.TransformationGraph. The design is proper as it works within the same jvm and with other app servers. I believe it is an issue with class loading as when I add all jars from jboss client folder, the connection is established on the beginning, but the the graph fails:

INFO  [WatchDog] - Pre-execute initialization of connection:
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] setting client socket wrapper class name to org.jboss.jms.client.remoting.ClientSocketWrapper
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] setting shouldCheckConnection to false
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] setting timeout to 0
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] constructed
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] setting client socket wrapper class name to org.jboss.jms.client.remoting.ClientSocketWrapper
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] setting shouldCheckConnection to false
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] setting timeout to 0
DEBUG [WatchDog] - Setting ping frequency to: 214748364
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] connecting
DEBUG [WatchDog] - Creating semaphore with size 50
DEBUG [WatchDog] - SocketClientInvoker[38d460, bisocket://127.0.0.1:4457] connected
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] setting maxPoolSize to 200
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] setting client socket wrapper class name to org.jboss.jms.client.remoting.ClientSocketWrapper
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] setting shouldCheckConnection to false
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] setting timeout to 0
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] constructed
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] setting maxPoolSize to 200
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] setting client socket wrapper class name to org.jboss.jms.client.remoting.ClientSocketWrapper
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] setting shouldCheckConnection to false
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] setting timeout to 0
DEBUG [WatchDog] - Setting ping frequency to: 214748364
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] connecting
DEBUG [WatchDog] - Creating semaphore with size 200
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] connected
DEBUG [WatchDog] - SocketClientInvoker[1248979, bisocket://127.0.0.1:4457] got exception: ClientSocketWrapper[Socket[addr=/127.0.0.1,port=4457,localport=37870].70c38c]
java.io.IOException: org.jboss.remoting.InvocationResponse
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	]at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at java.lang.Class.forName0(Native Method)
.
.
.
.

Note the line:

	]at java.security.AccessController.doPrivileged(Native Method)

Thank you Agata. We are in the process of procuring the server edition. Will test on that and check if it is working.

I have a good news: the JMSConnection from standalone CloverETL Designer to JBoss server works fine in 3.1.2 version (RC in the time being - release is planned for the beginning of October). There was really the problem with class-loading and it is resolved by usage of proper class loader when creating javax.jms.Connection object.

Thank you Agata for the information. We procured the Server edition. Haven’t tried it out yet. Having trouble deploying on JBoss application server with oracle as persisitence layer.

Will try out the 3.1.2 version when it is out.