scala play不断抛出InvocationTargetException

时间:2015-04-28 16:31:54

标签: scala exception sbt typesafe-activator

我正在尝试使用激活器和scala播放来开发简单的Web应用程序。它工作得非常好,但是当我尝试将一些外部JAR添加到lib/目录时,会抛出以下异常。即使我不从中导入任何东西。

任何线索?我尝试sbt clean并删除target/并重新启动激活器,但没有任何帮助。

Setting up Play fork run ... (use Ctrl+D to cancel)
Play fork run has failed due to:
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at play.runsupport.Reloader$.startDevMode(Reloader.scala:197)
    at play.forkrun.ForkRun$.startServer(ForkRun.scala:82)
    at play.forkrun.ForkRun.run(ForkRun.scala:173)
    at play.forkrun.ForkRun$$anonfun$settingUp$1.applyOrElse(ForkRun.scala:162)
    at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
    at play.forkrun.ForkRun.aroundReceive(ForkRun.scala:148)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
    at akka.actor.ActorCell.invoke(ActorCell.scala:487)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254)
    at akka.dispatch.Mailbox.run(Mailbox.scala:221)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
    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.NoSuchMethodError: scala.Predef$.ArrowAssoc(Ljava/lang/Object;)Ljava/lang/Object;
    at play.core.ReloadableApplication.<init>(ApplicationProvider.scala:100)
    at play.core.server.NettyServer$$anonfun$mainDev$1.apply(NettyServer.scala:319)
    at play.core.server.NettyServer$$anonfun$mainDev$1.apply(NettyServer.scala:318)
    at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
    at play.core.server.NettyServer$.mainDev(NettyServer.scala:317)
    at play.core.server.NettyServer$.mainDevHttpMode(NettyServer.scala:313)
    at play.core.server.NettyServer.mainDevHttpMode(NettyServer.scala)
    ... 20 more

1 个答案:

答案 0 :(得分:4)

您似乎已添加到lib/

  • 另一个二进制不兼容的scala-library
  • 版本
  • 或为Scala的不兼容版本构建的jar,例如,您的项目是为Scala 2.11.6配置的,并且您已添加了为Scala 2.10构建的jar

我建议您使用托管依赖项而不是lib/,请参阅: