2017-10-18 63 views
0

我有一個akka項目。java.lang.ClassNotFoundException:scala.Int加載類型安全配置時出錯

這是在src/resources文件夾下的application-1.conf。

akka { 
    loglevel="INFO" 
    actor { 
    provider = "akka.remote.RemoteActorRefProvider" 
    } 
    remote { 
    enabled-transports = ["akka.remote.netty.tcp"] 
    netty.tcp { 
    hostname = "127.0.0.1" 
    port = 2552 
    } 
    log-sent-messages=on 
    log-received-messages=on 
} 
} 

以下是我對包文件src/main/scala/example7_2中的example7_2的操作。

package example7_2 

import akka.actor.Actor 
class SimpleActor extends Actor { 
    override def receive: Receive = { 
    case msg => println(s"I have been created at 
    ${self.path.address.hostPort} and received message $msg") 
} 

}

我有以下主要的應用程序HelloAkkaRemoting10

package example7_2 

import akka.actor.ActorSystem 
import com.typesafe.config.ConfigFactory 

object HelloAkkaRemoting10 extends App { 
    val actorSystem = ActorSystem("HelloAkkaRemoting1", ConfigFactory.load("application-1")) 
} 

當我運行應用程序,我得到的

[error] (run-main-0) java.lang.ClassNotFoundException: scala.Int 
[error] java.lang.ClassNotFoundException: scala.Int 
[error]   at sbt.internal.inc.classpath.ClasspathFilter.loadClass(ClassLoaders.scala:74) 
[error]   at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
[error]   at java.lang.Class.forName0(Native Method) 
[error]   at java.lang.Class.forName(Class.java:348) 
[error]   at akka.actor.ReflectiveDynamicAccess.$anonfun$getClassFor$1(ReflectiveDynamicAccess.scala:21) 
[error]   at scala.util.Try$.apply(Try.scala:209) 
[error]   at akka.actor.ReflectiveDynamicAccess.getClassFor(ReflectiveDynamicAccess.scala:20) 
[error]   at akka.serialization.Serialization.$anonfun$bindings$3(Serialization.scala:313) 
[error]   at scala.collection.TraversableLike$WithFilter.$anonfun$map$2(TraversableLike.scala:739) 
[error]   at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:231) 
[error]   at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:462) 
[error]   at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:738) 
[error]   at akka.serialization.Serialization.<init>(Serialization.scala:311) 
[error]   at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:15) 
[error]   at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:12) 
[error]   at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:880) 
[error]   at akka.actor.ExtensionId.apply(Extension.scala:77) 
[error]   at akka.actor.ExtensionId.apply$(Extension.scala:77) 
[error]   at akka.serialization.SerializationExtension$.apply(SerializationExtension.scala:12) 
[error]   at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:203) 
[error]   at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:796) 
[error]   at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:793) 
[error]   at akka.actor.ActorSystemImpl._start(ActorSystem.scala:793) 
[error]   at akka.actor.ActorSystemImpl.start(ActorSystem.scala:809) 
[error]   at akka.actor.ActorSystem$.apply(ActorSystem.scala:244) 
[error]   at akka.actor.ActorSystem$.apply(ActorSystem.scala:287) 
[error]   at akka.actor.ActorSystem$.apply(ActorSystem.scala:262) 
[error]   at example7_2.HelloAkkaRemoting10$.delayedEndpoint$example7_2$HelloAkkaRemoting10$1(HelloAkkaRemoting10.scala:7) 
[error]   at example7_2.HelloAkkaRemoting10$delayedInit$body.apply(HelloAkkaRemoting10.scala:6) 
[error]   at scala.Function0.apply$mcV$sp(Function0.scala:34) 
[error]   at scala.Function0.apply$mcV$sp$(Function0.scala:34) 
[error]   at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) 
[error]   at scala.App.$anonfun$main$1$adapted(App.scala:76) 
[error]   at scala.collection.immutable.List.foreach(List.scala:389) 
[error]   at scala.App.main(App.scala:76) 
[error]   at scala.App.main$(App.scala:74) 
[error]   at example7_2.HelloAkkaRemoting10$.main(HelloAkkaRemoting10.scala:6) 
[error]   at example7_2.HelloAkkaRemoting10.main(HelloAkkaRemoting10.scala) 
[error]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
[error]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
[error]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
[error]   at java.lang.reflect.Method.invoke(Method.java:498) 
[error]   at sbt.Run.invokeMain(Run.scala:89) 
[error]   at sbt.Run.run0(Run.scala:83) 
[error]   at sbt.Run.execute$1(Run.scala:61) 
[error]   at sbt.Run.$anonfun$run$4(Run.scala:73) 
[error]   at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) 
[error]   at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10) 
[error]   at sbt.TrapExit$App.run(TrapExit.scala:252) 
[error]   at java.lang.Thread.run(Thread.java:748) 
[error] java.lang.RuntimeException: Nonzero exit code: 1 
[error]   at sbt.Run$.executeTrapExit(Run.scala:120) 
[error]   at sbt.Run.run(Run.scala:73) 
[error]   at sbt.Defaults$.$anonfun$bgRunMainTask$6(Defaults.scala:1130) 
[error]   at sbt.Defaults$.$anonfun$bgRunMainTask$6$adapted(Defaults.scala:1125) 
[error]   at sbt.internal.BackgroundThreadPool.$anonfun$run$1(DefaultBackgroundJobService.scala:359) 
[error]   at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) 
[error]   at scala.util.Try$.apply(Try.scala:209) 
[error]   at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:282) 
[error]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
[error]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[error]   at java.lang.Thread.run(Thread.java:748) 
[error] (chapter7/compile:runMain) Nonzero exit code: 1 
[error] Total time: 3 s, completed Oct 18, 2017 11:11:52 AM 

其他雜項的細節 -

SBT版本 - 1.0.2 斯卡拉版 - 2.12.3 阿卡版本 - 2.5。 4

在我看來ConfigFactory負載拋出錯誤,但不確定確切的根本原因。如果我缺少任何配置,請讓我知道。

+0

。 –

回答

1

這似乎是在SBT中的錯誤有沒有關係類型安全的配置,只略微阿卡,我有我沒有使用sbteclipse插件在所有提交的https://github.com/sbt/sbt/issues/3736

+0

嗨Arnout - 這方面的任何更新。你提到的問題已經關閉,它沒有太多細節。 –

+0

sbt問題仍然是開放的,但我不知道有人正在積極處理它。現在的解決方法是回到版本0.13.16。 –

+0

有人就此問題發表了評論:另一種解決方法可能是配置'fork in run:= true'。 –

相關問題