jersey
  1. jersey
  2. JERSEY-1792

UnrecoverableKeyException "Password must not be null" for ClientBuilder.newClient

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0-m13
    • Fix Version/s: 2.0-rc1, 2.0
    • Component/s: None
    • Labels:
      None

      Description

      @PostConstruct
          public void init() {
              client = ClientBuilder.newClient();
              target = client
      .target("http://localhost:8080/movieplex7/webresources/movie/");
          } 

      throws the following exception:

      Caused by: org.jboss.weld.exceptions.WeldException: WELD-000049 Unable to invoke [BackedAnnotatedMethod] @PostConstruct public org.glassfish.movieplex7.client.MovieClientBean.init() on org.glassfish.movieplex7.client.MovieClientBean@1729579
          at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:74)
          at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:56)
          at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:100)
          at org.jboss.weld.injection.producer.BeanInjectionTarget.postConstruct(BeanInjectionTarget.java:56)
          at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:161)
          at org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
          at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:103)
          at org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:64)
          at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:93)
          at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:82)
          at org.glassfish.movieplex7.client.MovieClientBean$Proxy$_$$_WeldClientProxy.getMovies(Unknown Source)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at javax.el.BeanELResolver.getValue(BeanELResolver.java:363)
          ... 73 more
      Caused by: java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
          at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
          at org.jboss.weld.annotated.runtime.RuntimeAnnotatedMembers.invokeMethod(RuntimeAnnotatedMembers.java:78)
          at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:72)
          ... 88 more
      Caused by: java.lang.IllegalStateException: Error initializing key manager factory (unrecoverable key).
          at org.glassfish.jersey.SslConfigurator.createSSLContext(SslConfigurator.java:648)
          at org.glassfish.jersey.SslConfigurator.getDefaultContext(SslConfigurator.java:277)
          at org.glassfish.jersey.client.JerseyClientBuilder.build(JerseyClientBuilder.java:126)
          at org.glassfish.jersey.client.JerseyClientBuilder.build(JerseyClientBuilder.java:59)
          at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114)
          at org.glassfish.movieplex7.client.MovieClientBean.init(MovieClientBean.java:72)
          ... 98 more
      Caused by: java.security.UnrecoverableKeyException: Password must not be null
          at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:124)
          at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:55)
          at java.security.KeyStore.getKey(KeyStore.java:792)
          at sun.security.ssl.SunX509KeyManagerImpl.<init>(SunX509KeyManagerImpl.java:131)
          at sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(KeyManagerFactoryImpl.java:68)
          at javax.net.ssl.KeyManagerFactory.init(KeyManagerFactory.java:259)
          at org.glassfish.jersey.SslConfigurator.createSSLContext(SslConfigurator.java:644)
          ... 103 more 
          @PostConstruct
          public void init() {
              client = ClientBuilder.newBuilder().sslContext(SslConfigurator.newInstance(false).createSSLContext()).build();
      //        client = ClientBuilder.newClient();
              target = client
                      .target("http://localhost:8080/movieplex7/webresources/movie/");
          }

      works.

        Issue Links

          Activity

          Hide
          arungupta added a comment -

          This is with GlassFish build 80.

          Show
          arungupta added a comment - This is with GlassFish build 80.
          Hide
          Marek Potociar added a comment -

          Duplicate of JERSEY-1790.

          Show
          Marek Potociar added a comment - Duplicate of JERSEY-1790 .
          Hide
          kenhparker added a comment -

          I'm having the same error message as here but unfortunatelly I do not understand how I can solve it.

          I would appreciate any help. Thanks

          Show
          kenhparker added a comment - I'm having the same error message as here but unfortunatelly I do not understand how I can solve it. I would appreciate any help. Thanks
          Hide
          Michal Gajdos added a comment -

          Are you using the latest version of Jersey? Can we see how you create an instance of the JAX-RS client?

          Show
          Michal Gajdos added a comment - Are you using the latest version of Jersey? Can we see how you create an instance of the JAX-RS client?

            People

            • Assignee:
              Unassigned
              Reporter:
              arungupta
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: