我创建了一个简单的spring webapp,用于触发线程并查询jms Queue以获取消息。 Web应用程序在JBoss 5.1中运行。我正在使用JBoss Developer Studio在应用程序服务器中创建和运行应用程序。应用程序服务器也在JBoss Developer Studio中运行。
线程正在运行,并且每5秒尝试查询一次Queue。但是,在尝试创建与队列的连接时,我遇到了异常。
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
webapp是依赖于两个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的问题我正在构建web应用程序。如果有人能提供帮助,我们将不胜感激。
感谢并为这篇长篇文章感到抱歉!
答案 0 :(得分:0)
我最近也遇到了这个问题并通过在相应应用程序的pom.xml中添加/使用以下依赖项(对于jms)来修复它 - > 注意:保持以下使用的依赖关系的范围。
<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>