title: Apache Tomcat 9 openSSL error thrown on startup
body: <p>I believe I know how to fix this - by making the following change in the tomcat configuration from:</p>
  <p>&lt;Connector port=&quot;443&quot; <strong>protocol=&quot;HTTP/1.1&quot;</strong>
  maxThreads=&quot;150&quot; scheme=&quot;https&quot; secure=&quot;true&quot; SSLEnabled=&quot;true&quot; clientAuth=&quot;false&quot; sslProtocol=&quot;TLS&quot; sslEnabledProtocols=&quot;TLSv1.2&quot; keyAlias=&quot;somealias&quot; keystoreFile=&quot;&quot; keystorePass=&quot;&quot; keystoreType=&quot;Windows-My&quot;/&gt;</p>
  <p>We need to define tomcat to use JSSE in the protocol by doing the following change:</p>
  <p>Connector port=&quot;443&quot; <strong>protocol=&quot;org.apache.coyote.http11.Http11NioProtocol&quot; sslImplementationName=&quot;org.apache.tomcat.util.net.jsse.JSSEImplementation&quot;</strong>
  maxThreads=&quot;150&quot; scheme=&quot;https&quot; secure=&quot;true&quot; SSLEnabled=&quot;true&quot; clientAuth=&quot;false&quot; sslProtocol=&quot;TLS&quot; sslEnabledProtocols=&quot;TLSv1.2&quot; keyAlias=&quot;somealias&quot; keystoreFile=&quot;&quot; keystorePass=&quot;&quot; keystoreType=&quot;Windows-My&quot;/&gt;</p>
  <p>What I would like to know is to understand how to make this work with openssl - it seems like it shouldn't matter which implementation I use? Any insight would be appreciated.</p>
  <p>OS Windows Server 2016</p>
  <p>Java jre1.8.0_261</p>
  <p>Loaded APR based Apache Tomcat Native library [1.2.23] using APR version [1.7.0].</p>
  <p>APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].</p>
  <p>APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]</p>
  <p>org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1c  28 May 2019]</p>
  <p>org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [&quot;http-nio-80&quot;]
  org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [&quot;https-openssl-nio-443&quot;]</p>
  <blockquote>
  <p>WARNING [main]
  org.apache.tomcat.util.net.openssl.OpenSSLContext.init Error
  initializing SSL context
  java.lang.NullPointerException
  at java.util.Base64$Encoder.encode(Unknown Source)
  at java.util.Base64$Encoder.encodeToString(Unknown Source)
  at org.apache.tomcat.util.net.openssl.OpenSSLContext.addCertificate(OpenSSLContext.java:405)
  at org.apache.tomcat.util.net.openssl.OpenSSLContext.init(OpenSSLContext.java:249)
  at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:247)
  at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:97)
  at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71)
  at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:218)
  at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1124)
  at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1137)
  at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:574)
  at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:74)
  at org.apache.catalina.connector.Connector.initInternal(Connector.java:980)
  at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
  at org.apache.catalina.core.StandardService.initInternal(StandardService.java:533)
  at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
  at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1059)
  at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
  at org.apache.catalina.startup.Catalina.load(Catalina.java:584)
  at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:304)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474) ...</p>
  <p>[main]
  org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
  [&quot;http-nio-80&quot;]  [main]
  org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
  [&quot;https-openssl-nio-443&quot;]  [main]
  org.apache.catalina.startup.Catalina.start Server startup in [42,116]
  milliseconds SEVERE
  [https-openssl-nio-443-exec-3]
  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun Error
  running socket processor
  java.lang.Exception: cannot create new ssl
  at org.apache.tomcat.jni.SSL.newSSL(Native Method)
  at org.apache.tomcat.util.net.openssl.OpenSSLEngine.(OpenSSLEngine.java:214)
  at org.apache.tomcat.util.net.openssl.OpenSSLContext.createSSLEngine(OpenSSLContext.java:492)
  at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLEngine(AbstractJsseEndpoint.java:119)
  at org.apache.tomcat.util.net.SecureNioChannel.processSNI(SecureNioChannel.java:329)
  at org.apache.tomcat.util.net.SecureNioChannel.handshake(SecureNioChannel.java:175)
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
  at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  at java.lang.Thread.run(Unknown Source)</p>
  </blockquote>