0 Replies Latest reply on May 24, 2012 4:03 PM by Michel Werren

    Caused by: java.util.jar.JarException: when packaging RESTEasy crypto within war

    Michel Werren Novice

      Hello together

       

      When i deploy the resteasy-crypto within the application .war i get the following exception.

       

      21:49:44,798 SCHWERWIEGEND [org.jboss.resteasy.core.SynchronousDispatcher] (http--127.0.0.1-8443-1) Failed executing POST /crypto: org.jboss.resteasy.spi.WriterException: org.bouncycastle.cms.CMSException: cannot create key generator: JCE cannot authenticate the provider BC

                at org.jboss.resteasy.security.smime.EnvelopedWriter.writeTo(EnvelopedWriter.java:100) [resteasy-crypto-2.3.3.Final.jar:]

                at org.jboss.resteasy.security.smime.EnvelopedWriter.writeTo(EnvelopedWriter.java:42) [resteasy-crypto-2.3.3.Final.jar:]

                at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:117) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.security.doseta.DigitalSigningInterceptor.write(DigitalSigningInterceptor.java:39) [resteasy-crypto-2.3.3.Final.jar:]

                at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:123) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.write(GZIPEncodingInterceptor.java:100) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:123) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:250) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:585) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:506) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar:]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

                at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

      Caused by: org.bouncycastle.cms.CMSException: cannot create key generator: JCE cannot authenticate the provider BC

                at org.bouncycastle.cms.jcajce.EnvelopedDataHelper.createKeyGenerator(Unknown Source) [bcmail-jdk16-1.46.jar:1.46.0]

                at org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder$CMSOutputEncryptor.<init>(Unknown Source) [bcmail-jdk16-1.46.jar:1.46.0]

                at org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder.build(Unknown Source) [bcmail-jdk16-1.46.jar:1.46.0]

                at org.jboss.resteasy.security.smime.EnvelopedWriter.writeTo(EnvelopedWriter.java:77) [resteasy-crypto-2.3.3.Final.jar:]

                ... 30 more

      Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC

                at javax.crypto.SunJCE_b.a(DashoA13*..) [jce.jar:1.6]

                at javax.crypto.KeyGenerator.getInstance(DashoA13*..) [jce.jar:1.6]

                at org.bouncycastle.jcajce.NamedJcaJceHelper.createKeyGenerator(Unknown Source) [bcmail-jdk16-1.46.jar:1.46.0]

                ... 34 more

      Caused by: java.util.jar.JarException: Cannot parse vfs:/C:/development/middleware/jboss-as-7.1.1.Final/bin/content/rest.war/WEB-INF/lib/bcprov-jdk16-1.46.jar

                at javax.crypto.SunJCE_c.a(DashoA13*..) [jce.jar:1.6]

                at javax.crypto.SunJCE_b.b(DashoA13*..) [jce.jar:1.6]

                at javax.crypto.SunJCE_b.a(DashoA13*..) [jce.jar:1.6]

                ... 37 more

       

       

       

      I found other posts with similar issues, for they the reason was an OSGI failure. But i am no really familiar with OSGI.

       

      But when there are other peoples with this problem, i have a workaround:

       

      - I attached the resteasy-crypto lib and all its dependencies as resources on the resteasy-jaxrs module.

      - Define the resteasy-crypto itself as module.