java.lang.NullPointerException

Spring JIRA | Flemming Jønsson | 2 years ago
  1. 0

    I had set the host, port, password, systemId, systemType and bindType on the SmppSessionFactoryBean initially and could connect to my smsc and send/receive texts. {code} <bean id="session" class="org.springframework.integration.smpp.session.SmppSessionFactoryBean" > <property name="host" value="${smpp.host}" /> <property name="port" value="${smpp.port}" /> <property name="password" value="${smpp.password}" /> <property name="systemId" value="${smpp.systemId}" /> <property name="systemType" value="${smpp.systemId}" /> <property name="bindType" value="BIND_TRX" /> </bean> {code} I was having some problems in my application and was debugging. These breakpoints caused the SessionStateListener in org.springframework.integration.smpp.session.SmppSessionFactoryBean.AutoReconnectLifecycle#registerSessionCloseListener to be triggered and perform the close and reschedule. However instead of reconnecting it threw NPE because the reconnectingExecutor had been set to null. Something is calling the stop method that in turn calls shutdown on the reconnectingExecutor and sets it to null. NPE: {code} 2014-11-14 01:01:20.900 INFO 58299 --- [ Thread-2] essionFactoryBean$AutoReconnectLifecycle : Session to 212.242.37.209:2775 has been closed. Try to reconnect later 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-3] org.jsmpp.session.SMPPSession : Sending enquire_link_resp 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-1] org.jsmpp.session.SMPPSession : Sending enquire_link_resp 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-3] o.jsmpp.session.AbstractSessionContext : Activity notified 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-3] o.s.i.smpp.inbound.SmppInboundGateway$1 : Receiving message : Fhddh����ghggg 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-3] o.s.i.smpp.inbound.SmppInboundGateway : received an SMS in class org.springframework.integration.smpp.inbound.SmppInboundGateway$1. Processing it. Exception in thread "Thread-2" java.lang.NullPointerException at org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle.scheduleReconnect(SmppSessionFactoryBean.java:548) at org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle.access$2200(SmppSessionFactoryBean.java:447) at org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle$1.onStateChange(SmppSessionFactoryBean.java:515) at org.jsmpp.session.AbstractSessionContext.fireStateChanged(AbstractSessionContext.java:83) at org.jsmpp.session.SMPPSessionContext.changeState(SMPPSessionContext.java:61) at org.jsmpp.session.AbstractSessionContext.close(AbstractSessionContext.java:62) at org.jsmpp.session.AbstractSession.close(AbstractSession.java:198) at org.jsmpp.session.SMPPSession$PDUReaderWorker.readPDU(SMPPSession.java:587) at org.jsmpp.session.SMPPSession$PDUReaderWorker.run(SMPPSession.java:551) {code} If I explicitly set the reconnectingExecutor property on the SmppSessionFactoryBean in my configuration - then the reconnect continues to work even when debugging/loosing network connection for a while or similar. The reason is that the setReconnectingExecutor method in SmppSessionFactoryBean also sets a boolean 'reconnectingExecutorSet' to true - and when that boolean is set, the stop() method will not shutdown or null the reconnectingExecutor : {code} <bean id="session" class="org.springframework.integration.smpp.session.SmppSessionFactoryBean" > <property name="host" value="${smpp.host}" /> <property name="port" value="${smpp.port}" /> <property name="password" value="${smpp.password}" /> <property name="systemId" value="${smpp.systemId}" /> <property name="systemType" value="${smpp.systemId}" /> <property name="bindType" value="BIND_TRX" /> <property name="reconnectingExecutor"> <bean class="java.util.concurrent.Executors" factory-method="newFixedThreadPool"> <constructor-arg value="1" type="int" /> </bean> </property> </bean> {code}

    Spring JIRA | 2 years ago | Flemming Jønsson
    java.lang.NullPointerException
  2. 0

    I had set the host, port, password, systemId, systemType and bindType on the SmppSessionFactoryBean initially and could connect to my smsc and send/receive texts. {code} <bean id="session" class="org.springframework.integration.smpp.session.SmppSessionFactoryBean" > <property name="host" value="${smpp.host}" /> <property name="port" value="${smpp.port}" /> <property name="password" value="${smpp.password}" /> <property name="systemId" value="${smpp.systemId}" /> <property name="systemType" value="${smpp.systemId}" /> <property name="bindType" value="BIND_TRX" /> </bean> {code} I was having some problems in my application and was debugging. These breakpoints caused the SessionStateListener in org.springframework.integration.smpp.session.SmppSessionFactoryBean.AutoReconnectLifecycle#registerSessionCloseListener to be triggered and perform the close and reschedule. However instead of reconnecting it threw NPE because the reconnectingExecutor had been set to null. Something is calling the stop method that in turn calls shutdown on the reconnectingExecutor and sets it to null. NPE: {code} 2014-11-14 01:01:20.900 INFO 58299 --- [ Thread-2] essionFactoryBean$AutoReconnectLifecycle : Session to 212.242.37.209:2775 has been closed. Try to reconnect later 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-3] org.jsmpp.session.SMPPSession : Sending enquire_link_resp 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-1] org.jsmpp.session.SMPPSession : Sending enquire_link_resp 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-3] o.jsmpp.session.AbstractSessionContext : Activity notified 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-3] o.s.i.smpp.inbound.SmppInboundGateway$1 : Receiving message : Fhddh����ghggg 2014-11-14 01:01:20.901 DEBUG 58299 --- [pool-1-thread-3] o.s.i.smpp.inbound.SmppInboundGateway : received an SMS in class org.springframework.integration.smpp.inbound.SmppInboundGateway$1. Processing it. Exception in thread "Thread-2" java.lang.NullPointerException at org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle.scheduleReconnect(SmppSessionFactoryBean.java:548) at org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle.access$2200(SmppSessionFactoryBean.java:447) at org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle$1.onStateChange(SmppSessionFactoryBean.java:515) at org.jsmpp.session.AbstractSessionContext.fireStateChanged(AbstractSessionContext.java:83) at org.jsmpp.session.SMPPSessionContext.changeState(SMPPSessionContext.java:61) at org.jsmpp.session.AbstractSessionContext.close(AbstractSessionContext.java:62) at org.jsmpp.session.AbstractSession.close(AbstractSession.java:198) at org.jsmpp.session.SMPPSession$PDUReaderWorker.readPDU(SMPPSession.java:587) at org.jsmpp.session.SMPPSession$PDUReaderWorker.run(SMPPSession.java:551) {code} If I explicitly set the reconnectingExecutor property on the SmppSessionFactoryBean in my configuration - then the reconnect continues to work even when debugging/loosing network connection for a while or similar. The reason is that the setReconnectingExecutor method in SmppSessionFactoryBean also sets a boolean 'reconnectingExecutorSet' to true - and when that boolean is set, the stop() method will not shutdown or null the reconnectingExecutor : {code} <bean id="session" class="org.springframework.integration.smpp.session.SmppSessionFactoryBean" > <property name="host" value="${smpp.host}" /> <property name="port" value="${smpp.port}" /> <property name="password" value="${smpp.password}" /> <property name="systemId" value="${smpp.systemId}" /> <property name="systemType" value="${smpp.systemId}" /> <property name="bindType" value="BIND_TRX" /> <property name="reconnectingExecutor"> <bean class="java.util.concurrent.Executors" factory-method="newFixedThreadPool"> <constructor-arg value="1" type="int" /> </bean> </property> </bean> {code}

    Spring JIRA | 2 years ago | Flemming Jønsson
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle.scheduleReconnect()
    2. org.springframework.integration
      SmppSessionFactoryBean$AutoReconnectLifecycle$1.onStateChange
      1. org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle.scheduleReconnect(SmppSessionFactoryBean.java:548)
      2. org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle.access$2200(SmppSessionFactoryBean.java:447)
      3. org.springframework.integration.smpp.session.SmppSessionFactoryBean$AutoReconnectLifecycle$1.onStateChange(SmppSessionFactoryBean.java:515)
      3 frames
    3. Apache ServiceMix :: Bundles :: ${pkgArtifactId}
      SMPPSession$PDUReaderWorker.run
      1. org.jsmpp.session.AbstractSessionContext.fireStateChanged(AbstractSessionContext.java:83)
      2. org.jsmpp.session.SMPPSessionContext.changeState(SMPPSessionContext.java:61)
      3. org.jsmpp.session.AbstractSessionContext.close(AbstractSessionContext.java:62)
      4. org.jsmpp.session.AbstractSession.close(AbstractSession.java:198)
      5. org.jsmpp.session.SMPPSession$PDUReaderWorker.readPDU(SMPPSession.java:587)
      6. org.jsmpp.session.SMPPSession$PDUReaderWorker.run(SMPPSession.java:551)
      6 frames