i 에코 서비스를 위해 이와 같은 스칼라 코드가 있습니다.scala 원격 액터 예외
수입 scala.actors.Actor 수입 scala.actors.Actor._ 수입 scala.actors.remote.RemoteActor._
class Echo extends Actor { def act() { alive(9010) register('myName, self) loop { react { case msg => println(msg) } } } } object EchoServer { def main(args: Array[String]): unit = { val echo = new Echo echo.start println("Echo server started") } } EchoServer.main(null)
하지만 몇 가지 예외가있다.
java.lang.NoClassDefFoundError: Main$$anon$1$Echo$$anonfun$act$1 at Main$$anon$1$Echo.act((virtual file):16) at scala.actors.Reaction.run(Reaction.scala:76) at scala.actors.Actor$$anonfun$start$1.apply(Actor.scala:785) at scala.actors.Actor$$anonfun$start$1.apply(Actor.scala:783) at scala.actors.FJTaskScheduler2$$anon$1.run(FJTaskScheduler2.scala:160) at scala.actors.FJTask$Wrap.run(Unknown Source) at scala.actors.FJTaskRunner.scanWhileIdling(Unknown Source) at scala.actors.FJTaskRunner.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: Main$$anon$1$Echo$$anonfun$act$1 at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 8 more
어떻게 그럴 수 있습니까? 길에 의해. 내 스칼라 버전은 2.7.5