0

I have a main object in akka.

object Application extends App {
  val system = ActorSystem()
  //...............
}

When I run it, it throws an exception of

Exception in thread "main" java.lang.NoSuchMethodError: akka.actor.ActorSystem.dispatcher()Lscala/concurrent/ExecutionContext;

How do I get rid of it?

I'm using akka 2.2.0

9
  • I think it's a problem with Akka 2.1. Are you on 2.1 or 2.2? Commented Jul 30, 2013 at 4:41
  • @HarshalPandya, that's 2.2.0 Commented Jul 30, 2013 at 4:45
  • may be duplicated with [this][1], hope it helps [1]: stackoverflow.com/questions/17890223/… Commented Jul 30, 2013 at 6:19
  • Which version of scala are you using? Akka 2.2.0 should be run with scala 2.10.+. If you somehow are trying to run it with scala 2.9 (by example) you are bound to have those kinds of errors as scala.concurrent.ExecutionContext was only added in scala 2.10.0. Commented Jul 30, 2013 at 7:48
  • @RégisJean-Gilles, scala 2.10 Commented Jul 30, 2013 at 8:35

1 Answer 1

2

Now that you have updated your answer with your "build.sbt" file, it is rather clear what is happening: your application has "org.scalaj" % "scalaj-http_2.9.2" % "0.3.7" as a dependency. You are forcing the scala version for "scalaj", meaning that you will (transitively) get scala 2.9.2 pulled in your classpath, in addition to scala 2.10.2. To avoid this, do not force the scala version in your dependencies, but let sbt infer it from your project's scala version, by using the %% operator instead of % (just like you did for your other dependencies):

"org.scalaj" %% "scalaj-http" % "0.3.9"

Note that I have upgraded the library version to 0.3.9 as it is apparently the first version to be available for scala 2.10.

Sign up to request clarification or add additional context in comments.

1 Comment

I can't compile it due to the error of (*:update) sbt.ResolveException: download failed: junit#junit;4.10!junit.src

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.