我开发了smpp客户端,当我一次又一次收到InvalidResponseException时,我的stacktrace增加了:

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)


然后stacktrace增加了:

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)


越来越大。怎么可能为什么stacktrace会累积?
在响应之间,我将SMPPSessionContext变量设置为null,将SMPPSession设置为null

最佳答案

据我所知,有一个close session事件的侦听器试图打开一个新会话。同时,connectAndBind方法在检测到故障时会尝试关闭会话,从而触发另一个递归循环。因此,停止这样做,停止尝试在close事件回调(这是您的类Gateway$SessionStateListenerImpl)内打开会话。

关于java - Java错误stacktrace累积,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10760891/

10-10 07:33