MDB JBoss 6.1服务器端没有响应

时间:2014-03-12 11:42:40

标签: java jboss

我创建了一个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 *

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

}

1 个答案:

答案 0 :(得分:0)

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

配置/添加Extensios元素

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

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

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

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

客户端故障检查周期的默认值为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

相关问题