Spray-can NoClassDefFoundError -


i'm new spray, can't work... :/

my build.sbt:

val apachedeps = seq(   "commons-validator" % "commons-validator" % "1.4.1" )  val sprayandakkadeps = {   val sprayv = "1.3.3"   seq(     "io.spray"            %%  "spray-can"     % sprayv,     "io.spray"            %%  "spray-routing" % sprayv,     "io.spray"            %%  "spray-testkit" % sprayv  % "test",     "com.typesafe.akka" %% "akka-actor" % "2.3.9"   ) }  name := "myapp" version := "1.0.0" scalaversion := "2.11.6"  librarydependencies ++= seq(   "org.mongodb" %% "casbah" % "2.8.1",   "ch.qos.logback" % "logback-classic" % "1.1.2",   "org.scala-lang.modules" %% "scala-xml" % "1.0.3",   "com.typesafe.play" %% "play-json" % "2.4.0",   "org.specs2" %% "specs2-core" % "3.6.1" % "test",   "com.netaporter" %% "scala-uri" % "0.4.7" ) ++ apachedeps ++ sprayandakkadeps  revolver.settings 

my main object:

import akka.actor._ import akka.io.io import akka.pattern.ask import spray.can.http import akka.util.timeout import scala.concurrent.duration._  object main extends app {    implicit val timeout = new timeout(5.seconds)    implicit val system = actorsystem("acontextgen")    val listener = system.actorof(props[listeners.myhttplistener], "httplistener")    io(http) ? http.bind(listener, interface = "localhost", port = 7777)  } 

my listener:

package listeners  import spray.routing._  class myhttplistener extends httpserviceactor {    def receive = runroute {      path("hi") {       {         complete("hello")       }     }    }  } 

and problem. when run output , server doesn't start on 7777 port

> gen[error] uncaught error thread [acontextgen-akka.actor.default-dispatcher-2] shutting down jvm since 'akka.jvm-exit-on-fatal-error' enabled actorsystem[acontextgen] gen[error] java.lang.noclassdeffounderror: shapeless/prependaux$ gen[error]      @ spray.routing.directives.pathdirectives$class.pathprefix(pathdirectives.scala:40) gen[error]      @ spray.routing.httpserviceactor.pathprefix(httpservice.scala:96) gen[error]      @ spray.routing.directives.pathdirectives$class.path(pathdirectives.scala:33) gen[error]      @ spray.routing.httpserviceactor.path(httpservice.scala:96) gen[error]      @ listeners.myhttplistener.receive(myhttplistener.scala:9) gen[error]      @ akka.actor.actorcell.newactor(actorcell.scala:558) gen[error]      @ akka.actor.actorcell.create(actorcell.scala:578) gen[error]      @ akka.actor.actorcell.invokeall$1(actorcell.scala:456) gen[error]      @ akka.actor.actorcell.systeminvoke(actorcell.scala:478) gen[error]      @ akka.dispatch.mailbox.processallsystemmessages(mailbox.scala:279) gen [error] [06/19/2015 18:41:00.089] [acontextgen-akka.actor.default-dispatcher-2] [actorsystem(acontextgen)] uncaught error thread [acontextgen-akka.actor.default-dispatcher-2] shutting down jvm since 'akka.jvm-exit-on-fatal-error' enabled gen java.lang.noclassdeffounderror: shapeless/prependaux$ gen     @ spray.routing.directives.pathdirectives$class.pathprefix(pathdirectives.scala:40) gen     @ spray.routing.httpserviceactor.pathprefix(httpservice.scala:96) gen     @ spray.routing.directives.pathdirectives$class.path(pathdirectives.scala:33) gen     @ spray.routing.httpserviceactor.path(httpservice.scala:96) gen     @ listeners.myhttplistener.receive(myhttplistener.scala:9) gen     @ akka.actor.actorcell.newactor(actorcell.scala:558) gen     @ akka.actor.actorcell.create(actorcell.scala:578) gen     @ akka.actor.actorcell.invokeall$1(actorcell.scala:456) gen     @ akka.actor.actorcell.systeminvoke(actorcell.scala:478) gen     @ akka.dispatch.mailbox.processallsystemmessages(mailbox.scala:279) gen     @ akka.dispatch.mailbox.run(mailbox.scala:220) gen     @ akka.dispatch.mailbox.exec(mailbox.scala:231) gen     @ scala.concurrent.forkjoin.forkjointask.doexec(forkjointask.java:260) gen     @ scala.concurrent.forkjoin.forkjoinpool$workqueue.pollandexecall(forkjoinpool.java:1253) gen     @ scala.concurrent.forkjoin.forkjoinpool$workqueue.runtask(forkjoinpool.java:1346) gen     @ scala.concurrent.forkjoin.forkjoinpool.runworker(forkjoinpool.java:1979) gen     @ scala.concurrent.forkjoin.forkjoinworkerthread.run(forkjoinworkerthread.java:107) gen caused by: java.lang.classnotfoundexception: shapeless.prependaux$ gen     @ java.net.urlclassloader$1.run(urlclassloader.java:372) gen     @ java.net.urlclassloader$1.run(urlclassloader.java:361) gen     @ java.security.accesscontroller.doprivileged(native method) gen     @ java.net.urlclassloader.findclass(urlclassloader.java:360) gen     @ java.lang.classloader.loadclass(classloader.java:424) gen     @ java.lang.classloader.loadclass(classloader.java:357) gen     ... 17 more gen  gen[error]      @ akka.dispatch.mailbox.run(mailbox.scala:220) gen[error]      @ akka.dispatch.mailbox.exec(mailbox.scala:231) gen[error]      @ scala.concurrent.forkjoin.forkjointask.doexec(forkjointask.java:260) gen[error]      @ scala.concurrent.forkjoin.forkjoinpool$workqueue.pollandexecall(forkjoinpool.java:1253) gen[error]      @ scala.concurrent.forkjoin.forkjoinpool$workqueue.runtask(forkjoinpool.java:1346) gen[error]      @ scala.concurrent.forkjoin.forkjoinpool.runworker(forkjoinpool.java:1979) gen[error]      @ scala.concurrent.forkjoin.forkjoinworkerthread.run(forkjoinworkerthread.java:107) gen[error] caused by: java.lang.classnotfoundexception: shapeless.prependaux$ gen[error]      @ java.net.urlclassloader$1.run(urlclassloader.java:372) gen[error]      @ java.net.urlclassloader$1.run(urlclassloader.java:361) gen[error]      @ java.security.accesscontroller.doprivileged(native method) gen[error]      @ java.net.urlclassloader.findclass(urlclassloader.java:360) gen[error]      @ java.lang.classloader.loadclass(classloader.java:424) gen[error]      @ java.lang.classloader.loadclass(classloader.java:357) gen[error]      ... 17 more gen ... finished exit code 255 

could explain me doing wrong? have followed example: https://github.com/spray/spray-template/tree/on_spray-can_1.3 works although

> show externaldependencyclasspath [info] list(attributed(/home/user256/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar), attributed(/home/user256/.ivy2/cache/org.mongodb/casbah-commons_2.11/jars/casbah-commons_2.11-2.8.1.jar), attributed(/home/user256/.ivy2/cache/com.github.nscala-time/nscala-time_2.11/jars/nscala-time_2.11-1.0.0.jar), attributed(/home/user256/.ivy2/cache/org.mongodb/mongo-java-driver/jars/mongo-java-driver-2.13.1.jar), attributed(/home/user256/.ivy2/cache/org.mongodb/casbah-core_2.11/jars/casbah-core_2.11-2.8.1.jar), attributed(/home/user256/.ivy2/cache/org.mongodb/casbah-query_2.11/jars/casbah-query_2.11-2.8.1.jar), attributed(/home/user256/.ivy2/cache/org.mongodb/casbah-gridfs_2.11/jars/casbah-gridfs_2.11-2.8.1.jar), attributed(/home/user256/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1.2.jar), attributed(/home/user256/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-1.1.2.jar), attributed(/home/user256/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.6.jar), attributed(/home/user256/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.3.jar), attributed(/home/user256/.ivy2/cache/com.typesafe.play/play-json_2.11/jars/play-json_2.11-2.4.0.jar), attributed(/home/user256/.ivy2/cache/com.typesafe.play/play-iteratees_2.11/jars/play-iteratees_2.11-2.4.0.jar), attributed(/home/user256/.ivy2/cache/org.scala-stm/scala-stm_2.11/jars/scala-stm_2.11-0.7.jar), attributed(/home/user256/.ivy2/cache/com.typesafe/config/bundles/config-1.3.0.jar), attributed(/home/user256/.ivy2/cache/com.typesafe.play/play-functional_2.11/jars/play-functional_2.11-2.4.0.jar), attributed(/home/user256/.ivy2/cache/com.typesafe.play/play-datacommons_2.11/jars/play-datacommons_2.11-2.4.0.jar), attributed(/home/user256/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.7.jar), attributed(/home/user256/.ivy2/cache/org.joda/joda-convert/jars/joda-convert-1.7.jar), attributed(/home/user256/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.6.jar), attributed(/home/user256/.ivy2/cache/com.fasterxml.jackson.core/jackson-core/bundles/jackson-core-2.5.3.jar), attributed(/home/user256/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/bundles/jackson-annotations-2.5.3.jar), attributed(/home/user256/.ivy2/cache/com.fasterxml.jackson.core/jackson-databind/bundles/jackson-databind-2.5.3.jar), attributed(/home/user256/.ivy2/cache/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/bundles/jackson-datatype-jdk8-2.5.3.jar), attributed(/home/user256/.ivy2/cache/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/bundles/jackson-datatype-jsr310-2.5.3.jar), attributed(/home/user256/.ivy2/cache/com.netaporter/scala-uri_2.11/jars/scala-uri_2.11-0.4.7.jar), attributed(/home/user256/.ivy2/cache/org.parboiled/parboiled_2.11/jars/parboiled_2.11-2.0.1.jar), attributed(/home/user256/.ivy2/cache/commons-validator/commons-validator/jars/commons-validator-1.4.1.jar), attributed(/home/user256/.ivy2/cache/commons-beanutils/commons-beanutils/jars/commons-beanutils-1.8.3.jar), attributed(/home/user256/.ivy2/cache/commons-logging/commons-logging/jars/commons-logging-1.2.jar), attributed(/home/user256/.ivy2/cache/commons-digester/commons-digester/jars/commons-digester-1.8.1.jar), attributed(/home/user256/.ivy2/cache/commons-collections/commons-collections/jars/commons-collections-3.2.1.jar), attributed(/home/user256/.ivy2/cache/io.spray/spray-can_2.11/bundles/spray-can_2.11-1.3.3.jar), attributed(/home/user256/.ivy2/cache/io.spray/spray-io_2.11/bundles/spray-io_2.11-1.3.3.jar), attributed(/home/user256/.ivy2/cache/io.spray/spray-util_2.11/bundles/spray-util_2.11-1.3.3.jar), attributed(/home/user256/.ivy2/cache/io.spray/spray-http_2.11/bundles/spray-http_2.11-1.3.3.jar), attributed(/home/user256/.ivy2/cache/org.parboiled/parboiled-scala_2.11/jars/parboiled-scala_2.11-1.1.7.jar), attributed(/home/user256/.ivy2/cache/org.parboiled/parboiled-core/jars/parboiled-core-1.1.7.jar), attributed(/home/user256/.ivy2/cache/io.spray/spray-routing-shapeless2_2.11/bundles/spray-routing-shapeless2_2.11-1.3.3.jar), attributed(/home/user256/.ivy2/cache/io.spray/spray-httpx_2.11/bundles/spray-httpx_2.11-1.3.3.jar), attributed(/home/user256/.ivy2/cache/org.jvnet.mimepull/mimepull/jars/mimepull-1.9.5.jar), attributed(/home/user256/.ivy2/cache/com.chuusai/shapeless_2.11/bundles/shapeless_2.11-2.1.0.jar), attributed(/home/user256/.ivy2/cache/com.typesafe.akka/akka-actor_2.11/jars/akka-actor_2.11-2.3.9.jar)) 

the reason shapeless 1.x , shapeless 2.x not compatible. however, if mix dependencies depend on both versions of shapeless sbt's dependency manager default evict older version. that's happened here:

> dependencytree myapp:myapp_2.11:1.0.0 [s]   +-com.netaporter:scala-uri_2.11:0.4.7 [s]   | +-org.parboiled:parboiled_2.11:2.0.1 [s]   |   +-com.chuusai:shapeless_2.11:2.0.0 [s]   |   +-io.spray:spray-routing_2.11:1.3.3 [s]   | +-com.chuusai:shapeless_2.11:1.2.4 (evicted by: 2.0.0)   | +-io.spray:spray-http_2.11:1.3.3 [s]   | | +-io.spray:spray-util_2.11:1.3.3 [s]   | | +-org.parboiled:parboiled-scala_2.11:1.1.7 [s]   | |   +-org.parboiled:parboiled-core:1.1.7   | | ... 

spray-routing still depends on shapeless 1.x while scala-uri relies on parboiled2 depends on shapeless 2.x.

the solution use spray-routing-shapeless2 module built problems this.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -