在 JBoss 5.1 中的队列中查找 JMS 消息的简单 Web 应用程序
我创建了一个简单的 spring web 应用程序,它触发一个线程并查询 jms 队列中的消息。该 Web 应用程序在 JBoss 5.1 中运行。我正在使用 JBoss Developer Studio 在应用程序服务器中创建和运行应用程序。应用程序服务器也在 JBoss Developer Studio 中运行。
该线程正在正确运行,并且尝试每 5 秒查询一次队列。但是,当尝试创建与队列的连接时,我遇到了异常。
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 install 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
Web 应用程序是通过依赖两个 jboss 库构建的。这些内容是从 JBoss 5.1 服务器本身中提取的。这些库是:
jboss-javaee.jar
jboss-messaging-client.jar
连接到队列的代码如下:
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);
尝试创建队列连接(connectionFactory.createQueueConnection();)时发生异常。我整个下午都在谷歌上搜索,但没有找到任何可以帮助解决我的问题的东西。
现在有人知道为什么会发生异常以及如何解决它吗?我感觉这是我用来构建网络应用程序的 jboss jar 的问题。如果有人可以提供帮助,我们将不胜感激。
感谢并抱歉这么长的帖子!
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 install 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最近也遇到了这个问题,并通过在相应应用程序的 pom.xml 中添加/使用以下依赖项(对于 jms)来修复它 - >
注意:保持依赖关系的范围,如下所示。
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.