I am trying to communicate between remote actors in scala using the Akka actors. My program runs fine from scala IDE but I am unable to run it from command prompt. In my project folder, I have the application.conf file, scala file and akka-remote_2.10-2.2.2.jar file. I am compiling my program as follows
scalac -cp akka-remote_2.10-2.2.2.jar FileName.scala
The program compiles and then I run it as follows
scala FileName
I get the following error
java.lang.ClassNotFoundException: akka.remote.RemoteActorRefProvider
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(Dynam
icAccess.scala:68)
at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(Dynam
icAccess.scala:67)
at scala.util.Try$.apply(Try.scala:161)
at akka.actor.ReflectiveDynamicAccess.getClassFor(DynamicAccess.scala:67
)
at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.sc
ala:85)
at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:546)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:111)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:93)
at Project1Bonus2$.main(Project1Bonus2.scala:11)
at Project1Bonus2.main(Project1Bonus2.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClass
Loader.scala:71)
at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoade
r.scala:31)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaC
lassLoader.scala:139)
at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scal
a:71)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLo
ader.scala:139)
at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala
:74)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
My application.conf file is as follows.
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 9001
}
}
}
Any help would be appreciated.
Thanks