1

我开发 smpp 客户端,当我一次又一次收到 InvalidResponseException 时,我的堆栈跟踪增加:

org.jsmpp.extra.NegativeResponseException: Negative response 0000000f found
    at org.jsmpp.session.AbstractSession.validateResponse(AbstractSession.java:162)
    at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:203)
    at org.jsmpp.session.SMPPSession.sendBind(SMPPSession.java:143)
    at org.jsmpp.session.SMPPSession.connectAndBind(SMPPSession.java:86)
    at com.sms.client.gw.Gateway.newSession(Gateway.java:107)
    at com.sms.client.gw.Gateway.getSession(Gateway.java:81)
    at com.sms.client.gw.Gateway.access$300(Gateway.java:33)
    at com.sms.client.gw.Gateway$SessionStateListenerImpl.onStateChange(Gateway.java:196)
    at org.jsmpp.session.AbstractSessionContext.fireStateChanged(AbstractSessionContext.java:69)
    at org.jsmpp.session.SMPPSessionContext.changeState(SMPPSessionContext.java:44)
    at org.jsmpp.session.AbstractSessionContext.close(AbstractSessionContext.java:58)
    at org.jsmpp.session.SMPPSessionContext.close(SMPPSessionContext.java:10)
    at org.jsmpp.session.AbstractSession.close(AbstractSession.java:141)

然后增加了堆栈跟踪:

org.jsmpp.extra.NegativeResponseException: Negative response 0000000f found
    at org.jsmpp.session.AbstractSession.validateResponse(AbstractSession.java:162)
    at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:203)
    at org.jsmpp.session.SMPPSession.sendBind(SMPPSession.java:143)
    at org.jsmpp.session.SMPPSession.connectAndBind(SMPPSession.java:86)
    at com.sms.client.gw.Gateway.newSession(Gateway.java:107)
    at com.sms.client.gw.Gateway.getSession(Gateway.java:81)
    at com.sms.client.gw.Gateway.access$300(Gateway.java:33)
    at com.sms.client.gw.Gateway$SessionStateListenerImpl.onStateChange(Gateway.java:196)
    at org.jsmpp.session.AbstractSessionContext.fireStateChanged(AbstractSessionContext.java:69)
    at org.jsmpp.session.SMPPSessionContext.changeState(SMPPSessionContext.java:44)
    at org.jsmpp.session.AbstractSessionContext.close(AbstractSessionContext.java:58)
    at org.jsmpp.session.SMPPSessionContext.close(SMPPSessionContext.java:10)
    at org.jsmpp.session.AbstractSession.close(AbstractSession.java:141)
    at org.jsmpp.session.SMPPSession.connectAndBind(SMPPSession.java:100)
    at com.sms.client.gw.Gateway.newSession(Gateway.java:107)
    at com.sms.client.gw.Gateway.getSession(Gateway.java:81)
    at com.sms.client.gw.Gateway.access$300(Gateway.java:33)
    at com.sms.client.gw.Gateway$SessionStateListenerImpl.onStateChange(Gateway.java:196)
    at org.jsmpp.session.AbstractSessionContext.fireStateChanged(AbstractSessionContext.java:69)
    at org.jsmpp.session.SMPPSessionContext.changeState(SMPPSessionContext.java:44)
    at org.jsmpp.session.AbstractSessionContext.close(AbstractSessionContext.java:58)
    at org.jsmpp.session.SMPPSessionContext.close(SMPPSessionContext.java:10)
    at org.jsmpp.session.AbstractSession.close(AbstractSession.java:141)
    at org.jsmpp.session.SMPPSession$EnquireLinkSender.run(SMPPSession.java:394)

而且越来越大。怎么可能?为什么堆栈跟踪会累积?在响应之间,我将 SMPPSessionContext 变量设置为 null,并将 SMPPSession 设置为 null

4

1 回答 1

1

据我所见,有一个close session事件监听器试图打开一个新会话。同时,该connectAndBind方法在检测到失败时会尝试关闭会话,从而触发另一个递归循环。所以停止这样做,停止尝试在close事件回调中打开会话(那是你的类Gateway$SessionStateListenerImpl)。

于 2012-05-25T21:02:08.270 回答