scala - Correction for error: - required:spray.httpx.marshalling.ToResponseMarshallable -
i'm new scala, , trying write little rest api. using scala 11.2, spray 1.3.1 , akka 2.3.6.
i trying compile example spray. error each of routes is: type mismatch; found : string("pong!!!!!!!!") required: spray.httpx.marshalling.toresponsemarshallable
i unsure if versions incompatibility issue or missing reference.
here route definition taken spray example :
package com.shenandoah.sbir.httpinterface import spray.routing.httpservice trait httpinterface extends httpservice { def pingroute = path("ping") { { complete("pong!!!!!!!!") } } def pongroute = path("pong") { { complete("pong!?") } } def piproute = path("pip") { { complete("moonshine") } } def rootroute = pingroute ~ pongroute ~ piproute } here actor: package com.shenandoah.sbir.httpinterface import akka.actor._ class httpinterfaceactor extends httpinterface actor { // httpservice trait defines // 1 abstract member, connects services environment // enclosing actor or test. def actorreffactory = context def receive = runroute(rootroute)
}
you using dependency "io.spray" % "spray-routing" % "2.3.6"
scala 2.10. there spray version published without scala version designation, compiled against scala 2.10. unfortunate.
use "io.spray" %% "spray-routing" % "2.3.6"
(note double %
) pull in dependency matching scala version. work both scala 2.10 , 2.11.
Comments
Post a Comment