Simple web app looking for JMS messages on a queue in JBoss 5.1
I've created a simple spring webapp which fires off a thread and queries a jms Queue for messages. The web app is running in JBoss 5.1. I'm using JBoss Developer Studio to create and run the app within the application server. The application server too, is being run within JBoss Developer Studio.
The thread is running correctly and is attempting to query the Queue every 5 seconds. However, when attempting to create a connection to the queue, I am getting an exception.
17:48:47,152 ERROR [JBossConnectionFactory] Failed to download and/or install client side AOP stack
org.jboss.jms.exception.MessagingJMSException: Failed to invoke
at org.jboss.jms.client.delegate.DelegateSupport.handleThrowable(DelegateSupport.java:271)
at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:205)
at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:160)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$getClientAOPStack$aop(ClientConnectionFactoryDelegate.java:251)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPStack(ClientConnectionFactoryDelegate.java)
at org.jboss.jms.client.ClientAOPStackLoader.load(ClientAOPStackLoader.java:75)
at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:192)
at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:101)
at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:95)
at com.thales.jms.service.JBossJmsService.reconnectPointToPoint(JBossJmsService.java:87)
at com.thales.jms.service.JBossJmsService.receive(JBossJmsService.java:53)
at com.thales.jms.service.JmsReceiverThread.run(JmsReceiverThread.java:19)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: org.jboss.jms.wireformat.ConnectionFactoryGetClientAOPStackRequest cannot be cast to org.jboss.jms.wireformat.RequestSupport
at org.jboss.jms.server.remoting.JMSServerInvocationHandler.invoke(JMSServerInvocationHandler.java:150)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:930)
at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:106)
at org.jboss.remoting.Client.invoke(Client.java:2034)
at org.jboss.remoting.Client.invoke(Client.java:877)
at org.jboss.remoting.Client.invoke(Client.java:865)
at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:189)
... 11 more
17:48:47,152 ERROR [STDERR] java.lang.RuntimeException: Failed to download and/or inst开发者_Python百科all client side AOP stack
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:199)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:101)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:95)
17:48:47,152 ERROR [STDERR] at com.thales.jms.service.JBossJmsService.reconnectPointToPoint(JBossJmsService.java:87)
17:48:47,152 ERROR [STDERR] at com.thales.jms.service.JBossJmsService.receive(JBossJmsService.java:53)
17:48:47,152 ERROR [STDERR] at com.thales.jms.service.JmsReceiverThread.run(JmsReceiverThread.java:19)
17:48:47,152 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
17:48:47,152 ERROR [STDERR] Caused by: org.jboss.jms.exception.MessagingJMSException: Failed to invoke
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.delegate.DelegateSupport.handleThrowable(DelegateSupport.java:271)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:205)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:160)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$getClientAOPStack$aop(ClientConnectionFactoryDelegate.java:251)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPStack(ClientConnectionFactoryDelegate.java)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.ClientAOPStackLoader.load(ClientAOPStackLoader.java:75)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:192)
17:48:47,152 ERROR [STDERR] ... 6 more
17:48:47,152 ERROR [STDERR] Caused by: java.lang.ClassCastException: org.jboss.jms.wireformat.ConnectionFactoryGetClientAOPStackRequest cannot be cast to org.jboss.jms.wireformat.RequestSupport
17:48:47,152 ERROR [STDERR] at org.jboss.jms.server.remoting.JMSServerInvocationHandler.invoke(JMSServerInvocationHandler.java:150)
17:48:47,152 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:930)
17:48:47,152 ERROR [STDERR] at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:106)
17:48:47,152 ERROR [STDERR] at org.jboss.remoting.Client.invoke(Client.java:2034)
17:48:47,152 ERROR [STDERR] at org.jboss.remoting.Client.invoke(Client.java:877)
17:48:47,152 ERROR [STDERR] at org.jboss.remoting.Client.invoke(Client.java:865)
17:48:47,152 ERROR [STDERR] at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:189)
17:48:47,153 ERROR [STDERR] ... 11 more
The webapp is built with dependencies to two jboss libraries. These have been extracted from the JBoss 5.1 server itself. The libraries are:
jboss-javaee.jar
jboss-messaging-client.jar
The code to connect to the queue is as follows:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
Context ic = new InitialContext(env);
QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ic.lookup("ConnectionFactory");
Queue queue = (Queue) ic.lookup("queue/DLQ");
connection = connectionFactory.createQueueConnection();
session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
receiver = session.createReceiver(queue);
The exception occurs when attempting to create the queue connection (connectionFactory.createQueueConnection();). I've been googling around all afternoon and have had no look in finding anything to help resolve my problem.
Does anyone now why the exception is occurring and how to solve it? I have a feeling it's an issue with the jboss jars I'm building the web app with. If anyone can help it would be greatly appreciated.
Thanks and sorry for the long post!
I also faced this issue recently and fixed it by adding/using the following dependencies(for jms) in the pom.xml of the corresponding application-> NOTE: Keep the scope of the dependencies as used below.
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jms-api</artifactId>
<version>1.1.0.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-profileservice-client</artifactId>
<version>6.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jboss.messaging</groupId>
<artifactId>jboss-messaging-client</artifactId>
<version>1.4.6.GA</version>
<scope>provided</scope>
</dependency>
精彩评论