title: How to setup basic Jersey/Grizzly 2.21 SSL startup configuration
body: <p>I'm trying to get a very basic Grizzly server up and running to allow for one-way SSL (HTTPS) connections to access jax-rs REST services.  Eventually I want two-way SSL security.</p>
  
  <p>I've gone through many of the examples and I just can't get anything to work.  I keep running into a SSL Handshake error.  Clearly I must be doing something stupid.  Any help is appreciated.</p>
  
  <p>Here is my code to start my embedded Grizzly server using the Jersey wrapper classes:</p>
  
  <pre><code>public static HttpServer startHttpsServer(URI listenerURI) throws IOException  {
    ResourceConfig resourceConfig = new ResourceConfig().packages("ws.argo.experiment.ssl");
  
    // First I tried this configuration using the certs from the Jersey sample code
    // Grizzly ssl configuration
    SSLContextConfigurator sslContext = new SSLContextConfigurator();
  
    // set up security context
    sslContext.setKeyStoreFile("./src/main/resources/keystore_server"); // contains server keypair
    sslContext.setKeyStorePass("asdfgh");
    sslContext.setTrustStoreFile("./src/main/resources/truststore_server"); // contains client certificate
    sslContext.setTrustStorePass("asdfgh");
  
    // Then I tried just using a default config - didn't work either
    //    sslContext = SSLContextConfigurator.DEFAULT_CONFIG;
  
  
    if (!sslContext.validateConfiguration(true)) {
      LOGGER.severe("Context is not valid");
  
    }
  
    LOGGER.finer("Starting Jersey-Grizzly2 JAX-RS secure server...");
    HttpServer httpServer; //=   GrizzlyHttpServerFactory.createHttpServer(listenerURI, resourceConfig, false);
  
  
    httpServer= GrizzlyHttpServerFactory.createHttpServer(
        listenerURI,
        resourceConfig,
        true,
        new   SSLEngineConfigurator(sslContext).setClientMode(false).setNeedClientAuth(false)
        );
  
  
  
    httpServer.getServerConfiguration().setName("Test HTTPS Server");
    httpServer.start();
    LOGGER.info("Started Jersey-Grizzly2 JAX-RS secure server.");
  
    return httpServer;
  }
  </code></pre>
  
  <p>I also tried replaced SSLEngineConfigurator(sslContext).setClientMode(false).setNeedClientAuth(false)  with null to see if that would help.  Nope.</p>
  
  <p>I always get the following error:</p>
  
  <pre><code>grizzly-nio-kernel(3) SelectorRunner, fatal error: 40: no cipher suites in common
  javax.net.ssl.SSLHandshakeException: no cipher suites in common
  %% Invalidated:  [Session-2, SSL_NULL_WITH_NULL_NULL]
  grizzly-nio-kernel(3) SelectorRunner, SEND TLSv1.2 ALERT:  fatal, description = handshake_failure
  grizzly-nio-kernel(3) SelectorRunner, WRITE: TLSv1.2 Alert, length = 2
  grizzly-nio-kernel(3) SelectorRunner, fatal: engine already closed.  Rethrowing javax.net.ssl.SSLHandshakeException: no cipher suites in common
  </code></pre>