Exception in thread “main” java.lang.NoSuchMethodError: scala.collection.JavaConversions$.asMap(Ljava/util/Map;)Lscala/collection/mutable/Map;

断了今生、忘了曾经 提交于 2019-12-11 07:51:39

问题


I am trying to use "gdata-scala-client" import google contacts using scala. I followed the instructions here, This is my sample code

import com.google.gdata.Service
import com.google.gdata.data.StdAtomFeed

object Con extends App {
println("hey")
val s = new Service("comp-test-1.0", "cp") {}
s.setUserCredentials("scalaprogrammer1@gmail.com", "xxxxxxxx")
val atomFeed = new StdAtomFeed
 val f = s.query("http://www.google.com/m8/feeds/contacts/scalaprogrammer1%40gmail.com/base", atomFeed.feedPickler)
 for (e <- f) println(e.title)
}

but I am getting this exception :

Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.JavaConversions$.asMap(Ljava/util/Map;)Lscala/collection/mutable/Map;
    at com.google.gdata.client.HttpConnection$HttpResponse.headers(HttpConnection.scala:215)
    at com.google.gdata.client.ClientLoginFactory.getToken(ClientLoginFactory.scala:104)
    at com.google.gdata.client.ClientLoginFactory.setUserCredentials(ClientLoginFactory.scala:59)
    at com.google.gdata.Service.setUserCredentials(Service.scala:62)
    at Con$delayedInit$body.apply(Con.scala:9)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:71)
    at scala.App$$anonfun$main$1.apply(App.scala:71)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
    at scala.App$class.main(App.scala:71)
    at Con$.main(Con.scala:6)
    at Con.main(Con.scala)

I am new to scala , can anybody suggest where am i lacking?

来源:https://stackoverflow.com/questions/18612329/exception-in-thread-main-java-lang-nosuchmethoderror-scala-collection-javacon

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!