title: Openshift, Tomcat 7, HTTPUrlConnection, javax.crypto.JceSecurity not found
body: <p>I am trying to run a very basic set of rest endpoints on OpenShift running Tomcat 7.  My code is running a very basic HTTPUrlConnection test that is throwing an exception.</p>
  
  <p>Code is this basic:</p>
  
  <pre><code>@GET
  @Path("/basicTest")
  public Response basicTest(@QueryParam("hostName") String hostName) {
      StringBuilder builder = new StringBuilder();
      Response response = null;
  
      try{
          URL urlObject = new URL( hostName );
          HttpURLConnection connection = (HttpURLConnection)urlObject.openConnection();
          BufferedReader in = new BufferedReader(new InputStreamReader( connection.getInputStream()));
  
          String inputLine;
  
          while ((inputLine = in.readLine()) != null)
              builder.append(inputLine);
          in.close();
  
          response = Response.status(200).entity(builder.toString()).build();
      } catch( Exception e){
          response = Response.status(200).entity(e.getMessage()).build();
      }
  
      return response;
  }
  </code></pre>
  
  <p>This runs just fine locally in Eclipse running Tomcat 7 and Java 7 on my Mac using either an HTTP or HTTPS URL. Against openshift HTTP works, but HTTPS I get this error:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.JceSecurity
  javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:178)
  sun.security.ssl.JsseJce.getKeyAgreement(JsseJce.java:285)
  sun.security.ssl.JsseJce.isEcAvailable(JsseJce.java:198)
  sun.security.ssl.CipherSuite$KeyExchange.isAvailable(CipherSuite.java:376)
  sun.security.ssl.CipherSuite.isAvailable(CipherSuite.java:194)
  sun.security.ssl.SSLContextImpl.getApplicableCipherSuiteList(SSLContextImpl.java:338)
  sun.security.ssl.SSLContextImpl.getDefaultCipherSuiteList(SSLContextImpl.java:296)
  sun.security.ssl.SSLSocketImpl.init(SSLSocketImpl.java:595)
  sun.security.ssl.SSLSocketImpl.&lt;init&gt;(SSLSocketImpl.java:530)
  sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:73)
  sun.net.www.protocol.https.HttpsClient.createSocket(HttpsClient.java:405)
  sun.net.NetworkClient.doConnect(NetworkClient.java:162)
  sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
  sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
  sun.net.www.protocol.https.HttpsClient.&lt;init&gt;(HttpsClient.java:264)
  sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
  sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
  sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:934)
  sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
  sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1302)
  sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
  jim.controller.UberController.basicTest(UberController.java:69)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  java.lang.reflect.Method.invoke(Method.java:606)
  com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
  com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
  com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
  com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
  com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
  com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
  com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
  com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
  com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
  com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
  com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
  com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
  com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
  com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
  com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  jim.servlet.RequestFilter.doFilter(RequestFilter.java:28)
  </code></pre>
  
  <p>I also have a test endpoint that dumps all of the OpenShift system properties.</p>
  
  <p><a href="http://www.jimflath.com/APITest/rest/jvmStat/details" rel="nofollow">http://www.jimflath.com/APITest/rest/jvmStat/details</a></p>