JMS: Server closed connection and reconnection not permitted

余生颓废 提交于 2019-12-24 19:16:58

问题


I want to count the messages in the queue.

InitialContext ctx = initQueue();
connFactory = (QueueConnectionFactory) ctx.lookup(CF_NAME);
queueConnection = connFactory.createQueueConnection();
queueConnection.start();
queueSession =
                queueConnection.createQueueSession(false, 
QueueSession.AUTO_ACKNOWLEDGE);
        queue = (Queue) ctx.lookup(queueName);

QueueBrowser queueBrowser = queueSession.createBrowser(queue);

But here it stops ------->QueueBrowser queueBrowser = queueSession.createBrowser(queue)

The error message is: Active session count: 1: org.wso2.andes.AMQDisconnectedException: Server closed connection and reconnection not permitted. javax.jms.JMSException: Error registering consumer: org.wso2.andes.AMQException: Woken up due to class javax.jms.JMSException at org.wso2.andes.client.AMQSession$6.execute(AMQSession.java:2143) at org.wso2.andes.client.AMQSession$6.execute(AMQSession.java:2086) at org.wso2.andes.client.AMQConnectionDelegate_8_0.executeRetrySupport(AMQConnectionDelegate_8_0.java:323) at org.wso2.andes.client.AMQConnection$3.run(AMQConnection.java:655) at java.security.AccessController.doPrivileged(Native Method) at org.wso2.andes.client.AMQConnection.executeRetrySupport(AMQConnection.java:652) at org.wso2.andes.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:102) at org.wso2.andes.client.AMQSession.createConsumerImpl(AMQSession.java:2084) at org.wso2.andes.client.AMQSession.createBrowserConsumer(AMQSession.java:1039) at org.wso2.andes.client.AMQQueueBrowser.(AMQQueueBrowser.java:51) at org.wso2.andes.client.AMQSession.createBrowser(AMQSession.java:1031) at org.wso2.andes.client.AMQSession.createBrowser(AMQSession.java:1018) at org.wso2.andes.client.AMQQueueSessionAdaptor.createBrowser(AMQQueueSessionAdaptor.java:87) at com.test.vediamo.ConnectionTest.doGet(ConnectionTest.java:96) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)


回答1:


Could you please create a queue first and then create the browser as follows?

QueueBrowser browser = queueSession.createBrowser(queueSession.createQueue("test-queue"));



来源:https://stackoverflow.com/questions/51614585/jms-server-closed-connection-and-reconnection-not-permitted

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!