[英]Akka version in Playframework
I am trying integrate some existing code with the play framework . 我正在尝试将一些现有代码与play框架集成。 I downloaded the 1.3.6 minimal Typesafe Activator package . 我下载了1.3.6最小的Typesafe Activator软件包 。 I created a play-java
project and modified the build.sbt
file with these lines: 我创建了一个play-java
项目并使用以下行修改了build.sbt
文件:
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
libraryDependencies ++= Seq(
"com.xxx" % "messages" % "0.0.1-SNAPSHOT"
)
I then added a reference to one of my existing classes in Application.java
. 然后我添加了对Application.java
现有类之一的引用。 When I ran activator run
, it downloaded a large number of jars, including the one that I had manually added and successfully compiled the code. 当我运行activator run
,它下载了大量的jar,包括我手动添加并成功编译代码的jar。
When it tries to run, I get an error: 当它试图运行时,我收到一个错误:
$ ./activator run
[info] Loading project definition from <APP_ROOT>/project
[info] Set current project to my-proj (in build file:<APP_ROOT>)
--- (Running the application, auto-reloading is enabled) ---
java.lang.ClassNotFoundException: akka.event.slf4j.Slf4jLoggingFilter
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(DynamicAccess.scala:67)
at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(DynamicAccess.scala:66)
at scala.util.Try$.apply(Try.scala:192)
at akka.actor.ReflectiveDynamicAccess.getClassFor(DynamicAccess.scala:66)
at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:84)
at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:612)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:143)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:127)
at play.api.libs.concurrent.ActorSystemProvider$.start(Akka.scala:291)
at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerStart.scala:205)
at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerStart.scala:61)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:60)
at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala:50)
at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)
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:223)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.devModeServer$lzycompute$1(PlayRun.scala:74)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRun.scala:74)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:100)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:53)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
Looking at version numbers, I think this is because we are using akka-actor 2.4.0-RC2, while activator is using 2.3. 看看版本号,我认为这是因为我们使用的是akka-actor 2.4.0-RC2,而激活器使用的是2.3。 Is there a way to get activator to use the 2.4? 有没有办法让激活者使用2.4? Or do I need to wait for a new release of activator? 或者我是否需要等待新版的激活剂?
I tried adding 我尝试添加
"com.typesafe.akka" % "akka-actor_2.11" % "2.4.0-RC2"
to libraryDependencies
, but that gave a warning about an evicted dependency and the same class not found error. to libraryDependencies
,但是它提供了关于被驱逐的依赖项和同一个类未找到错误的警告。
I am not overly familiar with the interaction between play
and activator
. 我对play
和activator
之间的互动并不十分熟悉。 If there is a way to make this work by getting rid of one of them without adding a lot of additional work, that is also fine. 如果有办法通过摆脱其中一个而不添加大量额外工作来完成这项工作,那也没关系。
I do not think it is the problem with the version. 我不认为这是版本的问题。 It looks like the problem with the Slf4j. 看起来像Slf4j的问题。
Try to add akka-slf4j in to the built.sbt
: 尝试将akka-slf4j添加到built.sbt
:
libraryDependencies += "com.typesafe.akka" %% "akka-slf4j" % "2.3.6"
Update 更新
For the akka actor 2.4.0 you need to add 2.4.0 version of slf4j: 对于akka actor 2.4.0,你需要添加2.4.0版本的slf4j:
libraryDependencies += "com.typesafe.akka" %% "akka-slf4j" % "2.4.0"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.