0
votes

I'm trying to run akka-http with rabbit mq client ('amqp-scala-client_2.12')

using scala version 2.12.

but i get an exception that:

Exception in thread "main" java.lang.NoClassDefFoundError: scala/Function1$class
at akka.http.scaladsl.server.PathMatcher.<init>(PathMatcher.scala:20)
at akka.http.scaladsl.server.ImplicitPathMatcherConstruction$$anon$8.<init>(PathMatcher.scala:267)
at akka.http.scaladsl.server.ImplicitPathMatcherConstruction$class._regex2PathMatcher(PathMatcher.scala:267)
at akka.http.scaladsl.server.PathMatcher$._regex2PathMatcher(PathMatcher.scala:105)
at         
  akka.http.scaladsl.server.PathMatchers$class.$init$(PathMatcher.scala:461)
at akka.http.scaladsl.server.Directives$.<init>(Directives.scala:40)
at akka.http.scaladsl.server.Directives$.<clinit>(Directives.scala)
at WebServer$.main(WebServer.scala:41)
at WebServer.main(WebServer.scala)
    Caused by: java.lang.ClassNotFoundException: scala.Function1$class
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

I guess it is because version collision because when disabling the rmq its works.

can you help or suggest other rmq library that will work thanks!

1

1 Answers

2
votes

You're using akka-http (akka-http-core_2.11) which is compiled with Scala 2.11, but your RMQ driver is 2.12. You need to decide which version of Scala you're using, and then use the driver compiled with that version. If you decide to use Scala 2.12, you need akka-http-core_2.12.