Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-2660

Null pointer exception in spring integration with ssl, using 2.2.0.M3

    XMLWordPrintable

    Details

      Description

      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)
      

      Looks like private volatile SSLContext sslContext; is not initialized.

      Its a runtime issue. I have following defined within the appconfig.xml:

      <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"/>
      

      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:

      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;
      
      }
      
      

        Attachments

          Activity

            People

            Assignee:
            grussell Gary Russell
            Reporter:
            ssinha Sachin Sinha
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.25d
                0.25d