gpt4 book ai didi

java - MDB JBoss 6.1 服务器端没有响应

转载 作者:行者123 更新时间:2023-12-03 23:34:59 25 4
gpt4 key购买 nike

我已经创建了一个客户端和服务器端的 JMS 项目。我的客户端是一个简单的 Java 应用程序,服务器是一个 Web 应用程序。当我使用客户端发送消息时,我在服务器上收到错误消息。

2014-03-12 17:00:52,991 WARN [org.hornetq.core.protocol.core.impl.RemotingConnectionImpl] (hornetq-failure-check-thread) 已检测到连接失败:未从/接收数据10.1.20.219:63869。客户端很可能在没有关闭连接的情况下退出或崩溃,或者服务器和客户端之间的网络出现故障。您也可能错误地配置了 connection-ttl 和 client-failure-check-period。请查看用户手册以获取更多信息。现在将关闭连接。 [代码=3]2014-03-12 17:00:52,994 WARN [org.hornetq.core.server.impl.ServerSessionImpl] (hornetq-failure-check-thread) 客户端连接失败,正在清除 session 7ccb43c0-a9d9-11e3-8873- 的资源0024e8c8aec32014-03-12 17:00:52,995 WARN [org.hornetq.core.server.impl.ServerSessionImpl] (hornetq-failure-check-thread) 清除 session 7ccb43c0-a9d9-11e3-8873-0024e8c8aec3*

客户端发送的所有消息都出现在队列中。但是我的 MDB bean 没有响应。请帮忙。

Bean代码

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.*;
/**
* Created by manodyas on 3/12/14.
*/
@MessageDriven(mappedName = "MsgBean.java", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination",propertyValue = "/queue/TestABC"),
@ActivationConfigProperty(propertyName = "clientFailureCheckPeriod", propertyValue = "600000"),
@ActivationConfigProperty(propertyName = "connectionTTL", propertyValue = "-1")
})

//@MessageDriven(activationConfig = {@ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),@ActivationConfigProperty(propertyName = "destination",propertyValue = "queue/TestABC") })
class MsgBean implements MessageListener{
public MsgBean()
{
}
public void onMessage(Message message)
{
System.out.println("test");
if (message instanceof TextMessage)
{
System.out.println("Order Accepted...!!");
}
else
{
System.out.println("Other..");
}
}

最佳答案

您可以尝试一些方法(我现在无法测试您的特定代码,所以我不确定这是否对您有帮助)。如果您能测试下面的 2 个建议并将结果报告给我们,我们将不胜感激。

配置/添加 Extensios 元素

添加扩展元素<extension module="org.jboss.as.messaging"/>内部元素。

配置 ClientFailureCheckPeriod 和 TTL 参数(尝试不仅在 MDB 中配置)

如果客户端在 client-failure-check-period 毫秒内没有收到任何数据包,那么它将认为连接失败并启动故障转移,或者调用任何 SessionFailureListener 实例(如果您使用 JMS,则调用 ExceptionListener 实例)取决于它的配置方式。

对于 JMS,检查周期由 HornetQConnectionFactory 实例上的 ClientFailureCheckPeriod 属性定义。如果 JMS 连接工厂实例直接部署到服务器端的 JNDI 中,可以在 JBOSS_DIST/jboss-as/server//deploy/hornetq/hornetq-jms.xml 配置文件中指定,使用参数 client-failure-检查期。

客户端故障检查周期的默认值为 30000 毫秒(30 秒)。值 -1 意味着如果没有从服务器接收到数据,客户端永远不会使客户端的连接失败。通常这比连接 TTL 值低得多,以允许客户端在出现暂时性故障时重新连接。

另一种方法是使用 MDB 中的注释来配置它(我可以在你的代码中看到你已经在这样做了)

@ActivationConfigProperty(propertyName = "clientFailureCheckPeriod", propertyValue = "600000")

@ActivationConfigProperty(propertyName = "connectionTTL", propertyValue = "-1")

您可以尝试的其他参数:

更多参数在这里:http://wildscribe.github.io/JBoss%20EAP/6.1.0/subsystem/messaging/hornetq-server/connection-factory/index.html

call-failover-timeout The timeout to use when fail over is in process (in ms).**
Attribute Value
Default Value -1
Type LONG
Nillable true
Expressions Allowed true

failover-on-initial-connection True to fail over on initial connection.
Attribute Value
Default Value false
Type BOOLEAN
Nillable true
Expressions Allowed

 reconnect-attempts The reconnect attempts.
Attribute Value
Default Value 0
Type INT
Nillable true
Expressions Allowed true

 retry-interval The retry interval.
Attribute Value
Default Value 2000
Type LONG
Nillable true
Expressions Allowed true

来源:

http://theopentutorials.com/examples/java-ee/ejb3/remote-jms-client-and-ejb3-mdb-consumer-eclipse-jboss-7-1/

https://community.jboss.org/thread/233579?_sscc=t

https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/5/html/HornetQ_User_Guide/ch15s02.html

http://wildscribe.github.io/JBoss%20EAP/6.1.0/subsystem/messaging/hornetq-server/connection-factory/index.html

关于java - MDB JBoss 6.1 服务器端没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22350424/

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