Java错误堆栈跟踪累积

时间:2012-05-25 20:20:32

标签: java exception

我开发了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

1 个答案:

答案 0 :(得分:1)

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