Getting exception ClassNotFound akka.remote.RemoteRefProvider

1,100 views
Skip to first unread message

aditya shrotri

unread,
Sep 15, 2013, 5:22:22 PM9/15/13
to akka...@googlegroups.com
Hi
I am trying to communicate between remote actors. My program run fine from eclipse but I am unable to run it from command prompt.

I am getting following exception

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)

and my application conf is 

akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { enabled-transports = ["akka.remote.netty.tcp"] netty.tcp { hostname = "127.0.0.1" port = 9001 } } }

I have tried to include akka-remote.jar in classpath but still getting the same error.

Any help would be appreciated.


√iktor Ҡlang

unread,
Sep 15, 2013, 5:24:49 PM9/15/13
to Akka User List
Hi Aditya,

You need to make sure that akka-remote is on your classpath, please refer to the documentation of your tooling s how to achieve that.

Cheers,



--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.



--
Viktor Klang
Director of Engineering

Twitter: @viktorklang

aditya shrotri

unread,
Sep 15, 2013, 5:34:12 PM9/15/13
to akka...@googlegroups.com
Hi 
I have akka-remote in my classpath. 

I also tried to load config from application.conf and from code using ConfigFactory.load, still getting same exception.

I am compiling the code like

scalac -cp akka-remote_2.10-2.2.2.jar Filename.scala

and for running,

scala FileName

and my code is compiling very well and I have put application.conf in the same folder.
I get the exception while running the code from command line.

Aditya

√iktor Ҡlang

unread,
Sep 15, 2013, 6:08:45 PM9/15/13
to Akka User List
Hi,


On Sun, Sep 15, 2013 at 11:34 PM, aditya shrotri <adis...@gmail.com> wrote:
Hi 
I have akka-remote in my classpath. 

If you did, you wouldn't get that exception.
 

I also tried to load config from application.conf and from code using ConfigFactory.load, still getting same exception.

I am compiling the code like

scalac -cp akka-remote_2.10-2.2.2.jar Filename.scala

and for running,

scala FileName

you are not passing in akka-remote to the scala command. Please refer to the documentation of the "scala" script.

Cheers,

aditya shrotri

unread,
Sep 15, 2013, 6:23:51 PM9/15/13
to akka...@googlegroups.com
Hi Victor,

I have tried now,

scala -cp akka-remote_2.10-2.2.2.jar FileName

but still getting the same exception.

Aditya

aditya shrotri

unread,
Sep 15, 2013, 7:14:56 PM9/15/13
to akka...@googlegroups.com
If I remove the remoteProvider and run it with remote dependancies, it runs fine.

Aditya

Roland Kuhn

unread,
Sep 16, 2013, 2:07:22 AM9/16/13
to akka...@googlegroups.com
Hi Aditya,

16 sep 2013 kl. 00:23 skrev aditya shrotri:

Hi Victor,

I have tried now,

scala -cp akka-remote_2.10-2.2.2.jar FileName

You need a lot more JARs than this one; I would definitely recommend that you use a build tool which supports dependency management (sbt, maven, … )

Regards,

Roland



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


Akka Team

unread,
Sep 16, 2013, 3:39:45 AM9/16/13
to Akka User List
Hi Aditya,


scala -cp akka-remote_2.10-2.2.2.jar FileName

Shouldn't that be 2.2.1? There is no 2.2.2 released so far.

-Endre



--
Akka Team
Typesafe - The software stack for applications that scale
Blog: letitcrash.com
Twitter: @akkateam

aditya shrotri

unread,
Sep 20, 2013, 7:26:49 PM9/20/13
to akka...@googlegroups.com
Thanks guys,
Problem solved when I used sbt. it seems it requires many Jar files than akka-remote.jar.

,
A
Reply all
Reply to author
Forward
0 new messages