【问题标题】:MDB JBoss 6.1 Server side is not respondingMDB JBoss 6.1 服务器端没有响应
【发布时间】:2014-04-22 05:27:05
【问题描述】:

我已经创建了一个客户端和服务器的 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)客户端连接失败,清除会话 7ccb43c0-a9d9-11e3-8873-的资源0024e8c8aec3 2014-03-12 17:00:52,995 WARN [org.hornetq.core.server.impl.ServerSessionImpl] (hornetq-failure-check-thread) 清除了会话 7ccb43c0-a9d9-11e3-8873-0024e8c8aec3* 的资源p>

客户端发送的所有消息都出现在队列中。但是我的 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..");
    }
}

}

【问题讨论】:

    标签: java jboss


    【解决方案1】:

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

    配置/添加 Extensios 元素

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

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

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

    对于 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

    【讨论】:

      猜你喜欢
      • 2015-08-03
      • 1970-01-01
      • 2021-03-19
      • 1970-01-01
      • 1970-01-01
      • 2016-12-25
      • 2018-04-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多