java.lang.NullPointerException

SpringSource Issue Tracker | Sachin Sinha | 5 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    {code} java.lang.NullPointerException at org.springframework.integration.ip.tcp.connection.support.DefaultTcpNioSSLConnectionSupport.createNewConnection(DefaultTcpNioSSLConnectionSupport.java:49) at org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionFactory.obtainConnection(TcpNioClientConnectionFactory.java:93) {code} Looks like private volatile SSLContext sslContext; is not initialized. Its a runtime issue. I have following defined within the appconfig.xml: {code} <bean id="sslContextSupport" class="org.springframework.integration.ip.tcp.connection.support.DefaultTcpSSLContextSupport"> <constructor-arg value="testkeystore"/> <constructor-arg value="testtruststore"/> <constructor-arg value="testing"/> <constructor-arg value="testing"/> </bean> <bean id="javaSerializer" class="org.springframework.core.serializer.DefaultSerializer"/> <bean id="javaDeserializer" class="org.springframework.core.serializer.DefaultDeserializer"/> <int-ip:tcp-connection-factory id="clientFactory" host="10.3.30.52" port="2017" single-use="true" type="client" deserializer="javaDeserializer" serializer="javaSerializer" using-nio="true" ssl-context-support="sslContextSupport"/> <int:channel id="requests"></int:channel> <int:channel id="replies"> <int:queue capacity="10"/> </int:channel> <int-ip:tcp-outbound-channel-adapter channel="requests" connection-factory="clientFactory" id="outboundClient"/> <int-ip:tcp-inbound-channel-adapter channel="replies" connection-factory="clientFactory" id="inboundClient"/> {code} Within the code if I am trying to send my login request to requests channel and where its failing. In case if I debug my code I see following: {code} public TcpNioConnection createNewConnection(SocketChannel socketChannel, boolean server, boolean lookupHost) throws Exception { SSLEngine sslEngine = this.sslContext.createSSLEngine(); // THIS IS WHERE ITS FAILING TcpNioSSLConnection tcpNioSSLConnection = new TcpNioSSLConnection(socketChannel, server, lookupHost, sslEngine); tcpNioSSLConnection.init(); return tcpNioSSLConnection; } {code}

    Spring JIRA | 5 years ago | Sachin Sinha
    java.lang.NullPointerException
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    {code} java.lang.NullPointerException at org.springframework.integration.ip.tcp.connection.support.DefaultTcpNioSSLConnectionSupport.createNewConnection(DefaultTcpNioSSLConnectionSupport.java:49) at org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionFactory.obtainConnection(TcpNioClientConnectionFactory.java:93) {code} Looks like private volatile SSLContext sslContext; is not initialized. Its a runtime issue. I have following defined within the appconfig.xml: {code} <bean id="sslContextSupport" class="org.springframework.integration.ip.tcp.connection.support.DefaultTcpSSLContextSupport"> <constructor-arg value="testkeystore"/> <constructor-arg value="testtruststore"/> <constructor-arg value="testing"/> <constructor-arg value="testing"/> </bean> <bean id="javaSerializer" class="org.springframework.core.serializer.DefaultSerializer"/> <bean id="javaDeserializer" class="org.springframework.core.serializer.DefaultDeserializer"/> <int-ip:tcp-connection-factory id="clientFactory" host="10.3.30.52" port="2017" single-use="true" type="client" deserializer="javaDeserializer" serializer="javaSerializer" using-nio="true" ssl-context-support="sslContextSupport"/> <int:channel id="requests"></int:channel> <int:channel id="replies"> <int:queue capacity="10"/> </int:channel> <int-ip:tcp-outbound-channel-adapter channel="requests" connection-factory="clientFactory" id="outboundClient"/> <int-ip:tcp-inbound-channel-adapter channel="replies" connection-factory="clientFactory" id="inboundClient"/> {code} Within the code if I am trying to send my login request to requests channel and where its failing. In case if I debug my code I see following: {code} public TcpNioConnection createNewConnection(SocketChannel socketChannel, boolean server, boolean lookupHost) throws Exception { SSLEngine sslEngine = this.sslContext.createSSLEngine(); // THIS IS WHERE ITS FAILING TcpNioSSLConnection tcpNioSSLConnection = new TcpNioSSLConnection(socketChannel, server, lookupHost, sslEngine); tcpNioSSLConnection.init(); return tcpNioSSLConnection; } {code}

    Spring JIRA | 5 years ago | Sachin Sinha
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.integration.ip.tcp.connection.support.DefaultTcpNioSSLConnectionSupport.createNewConnection()
    2. org.springframework.integration
      DefaultTcpNioSSLConnectionSupport.createNewConnection
      1. org.springframework.integration.ip.tcp.connection.support.DefaultTcpNioSSLConnectionSupport.createNewConnection(DefaultTcpNioSSLConnectionSupport.java:49)
      1 frame
    3. Spring Integration IP Support
      TcpNioClientConnectionFactory.obtainConnection
      1. org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionFactory.obtainConnection(TcpNioClientConnectionFactory.java:93)
      1 frame