kamon-io / sbt-aspectj-runner

sbt plugin for running aspectj weaver
Other
34 stars 16 forks source link

Unable to authenticate bouncy castle #20

Open DrewDennison opened 6 years ago

DrewDennison commented 6 years ago

hello added this plugin and now I'm seeing this error in my play-2.6 app. Does this have something to do with AspectJ?



play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[NoSuchProviderException: JCE cannot authenticate the provider BC]]
    at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:255)
    at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:182)
    at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:310)
    at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:308)
    at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:414)
    at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
    at scala.concurrent.impl.CallbackRunnable.run_aroundBody0(Promise.scala:60)
    at scala.concurrent.impl.CallbackRunnable$AjcClosure1.run(Promise.scala:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
    at kamon.scala.instrumentation.FutureInstrumentation.$anonfun$aroundExecution$1(FutureInstrumentation.scala:46)
    at kamon.Kamon$.withContext(Kamon.scala:120)
    at kamon.scala.instrumentation.FutureInstrumentation.aroundExecution(FutureInstrumentation.scala:46)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:59)
    at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
    at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81)
    at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:43)
    at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC
    at javax.crypto.JceSecurity.getInstance(JceSecurity.java:100)
    at javax.crypto.Mac.getInstance(Mac.java:222)
    at pdi.jwt.JwtUtils$.sign(JwtUtils.scala:121)
    at pdi.jwt.JwtUtils$.sign(JwtUtils.scala:150)
    at pdi.jwt.JwtUtils$.sign(JwtUtils.scala:159)
    at pdi.jwt.JwtCore.encode(Jwt.scala:80)
    at pdi.jwt.JwtCore.encode$(Jwt.scala:78)
    at pdi.jwt.JwtJson$.encode(JwtJson.scala:12)
    at pdi.jwt.JwtJsonCommon.encode(JwtJsonCommon.scala:25)
    at pdi.jwt.JwtJsonCommon.encode$(JwtJsonCommon.scala:24)
    at pdi.jwt.JwtJson$.encode(JwtJson.scala:12)
    at pdi.jwt.JwtSession.serialize(JwtSession.scala:61)
    at pdi.jwt.JwtPlayImplicits$RichResult.withJwtSession(JwtPlayImplicits.scala:61)
    at pdi.jwt.JwtPlayImplicits$RichResult.addingToJwtSession(JwtPlayImplicits.scala:82)
    at controllers.LoginController.$anonfun$index$2(LoginController.scala:61)
    at scala.util.Success.$anonfun$map$1(Try.scala:251)
    at scala.util.Success.map(Try.scala:209)
    at scala.concurrent.Future.$anonfun$map$1(Future.scala:289)
    at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
    at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
    ... 18 common frames omitted
Caused by: java.util.jar.JarException: Class is on the bootclasspath
    at javax.crypto.JarVerifier.verify(JarVerifier.java:286)
    at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:159)
    at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:185)
    at javax.crypto.JceSecurity.getInstance(JceSecurity.java:97)
    ... 37 common frames omitted```
tg44 commented 6 years ago

I have this one too. I'm not a pro with the signed jar world, but; BC is a signed and trusted jar. When the aspectJ tries to wire/mock/override functions I think its repacks the libs in my classpath, which will break the signatures.

I think some option with "don't touch those jars" would be more then enough, and that would solve a lot of other issues too. (I have no time right now to find out how can I pr this into the lib :( but wanted to share my findings.)