gpt4 book ai didi

java - 在 JBoss 5.1 中的队列中查找 JMS 消息的简单 Web 应用程序

转载 作者:行者123 更新时间:2023-12-01 05:41:38 24 4
gpt4 key购买 nike

我创建了一个简单的 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 的问题。如果有人可以提供帮助,我们将不胜感激。

感谢并抱歉发了这么长的帖子!

最佳答案

我最近也遇到了这个问题,并通过在相应应用程序的 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>

关于java - 在 JBoss 5.1 中的队列中查找 JMS 消息的简单 Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7014802/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com