SBT项目在运行时导致NoClassDefFoundError

时间:2016-05-27 22:57:39

标签: scala intellij-idea sbt repository spray

我正在玩依赖项并遇到问题。我想从spray-json切换到spray-json-shapedless。代码将编译,IntelliJ不会抱怨任何错误,但我不断收到java.lang.NoClassDefFoundError: shapeless/PrependAux$的运行时错误。我最终备份了现有项目,然后执行git reset --hard以使其再次运行。这不起作用,我仍然是相同的运行时错误。我已经尝试清除目标目录,maven / ivy / sbt缓存和升级SBT。也许我没有按照正确的顺序做到这一点。我确实读过有关喷雾/无形问题但我觉得我的版本是正确的。我知道上次我检查git时一切正常,所以其他东西搞砸了。我可以发布build.sbt,但我100%承诺你这个版本的代码昨天运行。

错误:

[ERROR] [05/27/2016 17:35:36.732] [xxx-xxxx-service-system-
akka.actor.default-dispatcher-2] [akka://xxx-xxxx-service-system/user/xxx-xxxx-service] null
akka.actor.ActorInitializationException: exception during creation
    at akka.actor.ActorInitializationException$.apply(Actor.scala:166)
    at akka.actor.ActorCell.create(ActorCell.scala:596)
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:456)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
    at akka.dispatch.Mailbox.run(Mailbox.scala:219)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
    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)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at akka.util.Reflect$.instantiate(Reflect.scala:66)
    at akka.actor.ArgsReflectConstructor.produce(Props.scala:352)
    at akka.actor.Props.newActor(Props.scala:252)
    at akka.actor.ActorCell.newActor(ActorCell.scala:552)
    at akka.actor.ActorCell.create(ActorCell.scala:578)
    ... 9 more
**Caused by: java.lang.NoClassDefFoundError: shapeless/PrependAux$**
    at spray.routing.directives.PathDirectives$class.pathPrefix(PathDirectives.scala:40)
    at com.tacos.arch.rest.service.MHttpServiceActor.pathPrefix(MHttpServiceActor.scala:10)
    at com.tacos.arch.rest.MRoutingDirectives$class.terminalPath(MRoutingDirectives.scala:11)
    at com.tacos.arch.rest.service.MHttpServiceActor.terminalPath(MHttpServiceActor.scala:10)
    at com.tacos.arch.PricingService$class.sayHi(PricingService.scala:139)
    at com.tacos.arch.PricingService$class.$init$(PricingService.scala:188)
    at com.tacos.arch.PricingActor.<init>(PricingActor.scala:5)
    ... 18 more
Caused by: java.lang.ClassNotFoundException: shapeless.PrependAux$
    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)
    ... 25 more

0 个答案:

没有答案