Chris Stewart
Chris Stewart

Reputation: 1679

Scala Spray no class def found Spray Execution Directives

I'm launching a spray http server. The first request I send to the server is proccessed successfully, however subsuquent requests fail to be processed and this stack trace is logged:

Uncaught error from thread [NflDbApiActorSystemConfig-akka.actor.default-dispatcher-3] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[NflDbApiActorSystemConfig]
java.lang.NoClassDefFoundError: spray/routing/directives/ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1$1
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4.spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1(ExecutionDirectives.scala:34)
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$apply$2.applyOrElse(ExecutionDirectives.scala:37)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext.failWith(RequestContext.scala:246)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:136)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:134)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:401)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.ClassNotFoundException: spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1$1
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 32 more
Uncaught error from thread [NflDbApiActorSystemConfig-akka.actor.default-dispatcher-6] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[NflDbApiActorSystemConfig]
java.lang.NoClassDefFoundError: spray/routing/directives/ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1$1
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4.spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1(ExecutionDirectives.scala:34)
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$apply$2.applyOrElse(ExecutionDirectives.scala:37)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext.failWith(RequestContext.scala:246)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:136)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:134)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:401)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Uncaught error from thread [NflDbApiActorSystemConfig-akka.actor.default-dispatcher-10] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[NflDbApiActorSystemConfig]
java.lang.NoClassDefFoundError: spray/routing/directives/ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1$1
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4.spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1(ExecutionDirectives.scala:34)
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$apply$2.applyOrElse(ExecutionDirectives.scala:37)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext.failWith(RequestContext.scala:246)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:136)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:134)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:401)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Uncaught error from thread [NflDbApiActorSystemConfig-akka.actor.default-dispatcher-4] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[NflDbApiActorSystemConfig]
java.lang.NoClassDefFoundError: spray/routing/directives/ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1$1
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4.spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1(ExecutionDirectives.scala:34)
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$apply$2.applyOrElse(ExecutionDirectives.scala:37)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext.failWith(RequestContext.scala:246)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:136)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:134)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:401)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Uncaught error from thread [NflDbApiActorSystemConfig-akka.actor.default-dispatcher-11] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[NflDbApiActorSystemConfig]
java.lang.NoClassDefFoundError: spray/routing/directives/ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1$1
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4.spray$routing$directives$ExecutionDirectives$class$$anonfun$$anonfun$$handleError$1(ExecutionDirectives.scala:34)
    at spray.routing.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$4$$anonfun$apply$2.applyOrElse(ExecutionDirectives.scala:37)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$1.handle(RequestContext.scala:84)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext$$anon$3.handle(RequestContext.scala:102)
    at akka.spray.UnregisteredActorRefBase.$bang(UnregisteredActorRefBase.scala:72)
    at spray.routing.RequestContext.failWith(RequestContext.scala:246)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.applyOrElse(ExecutionDirectives.scala:89)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:136)
    at scala.concurrent.Future$$anonfun$onFailure$1.apply(Future.scala:134)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:401)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Uncaught error from thread [NflDbApiActorSystemConfig-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[NflDbApiActorSystemConfig

I'm unfamiliar with ExecutionDirectives errors or where to start looking to figure out my issue. It appears that some class is not being found by my code - but I'm not really sure which one.

Can anyone provide some insight into this error?

Upvotes: 0

Views: 87

Answers (1)

Chris Stewart
Chris Stewart

Reputation: 1679

The issue was that I had two unique ActorSystems where my server was being started.

Upvotes: 0

Related Questions