mongodb - Server Exception occurs in running sbt project in IntelliJ -
i starting learn scala , running application intellij ide. trouble in running project following serverexception. explain briefly project. connect mongodb scala application , use scala version 2.10.0 , jdk 8.
this build.sbt
name := "mongodbandscala" version := "0.1" scalaversion := "2.10.0" librarydependencies ++= seq( "org.mongodb" %% "casbah" % "2.6.0", "org.slf4j" % "slf4j-simple" % "1.6.4" ) scalacoptions += "-deprecation"
this common.scala
import com.mongodb.casbah.imports._ case class stock (symbol: string, price: double) object common { def buildmongodbobject(stock: stock): mongodbobject = { val builder = mongodbobject.newbuilder builder += "symbol" -> stock.symbol builder += "price" -> stock.price builder.result } }
this mongofactory.scala
import com.mongodb.casbah.mongoconnection object mongofactory { private val server = "localhost" private val port = 27017 private val database = "portfolio" private val collection = "stocks" val connection = mongoconnection(server) val collection = connection(database)(collection) }
this insert.scala , cannot run till now.
import com.mongodb.casbah.imports._ import common._ object insert extends app { // create stock instances val apple = stock("aapl", 600) val google = stock("goog", 650) val netflix = stock("nflx", 60) // save them mongodb database savestock(apple) savestock(google) savestock(netflix) // our 'save' method def savestock(stock: stock) { val mongoobj = buildmongodbobject(stock) mongofactory.collection.save(mongoobj) } }
now in trouble following exception. can mention answer question?
> error:scalac: error: > org.jetbrains.jps.incremental.scala.remote.serverexception > > error compiling sbt component 'compiler-interface-2.10.0-52.0' > > @ > sbt.compiler.analyzingcompiler$$anonfun$compilesources$1$$anonfun$apply$2.apply(analyzingcompiler.scala:145) > > @ > sbt.compiler.analyzingcompiler$$anonfun$compilesources$1$$anonfun$apply$2.apply(analyzingcompiler.scala:142) > > @ sbt.io$.withtemporarydirectory(io.scala:291) > > @ > sbt.compiler.analyzingcompiler$$anonfun$compilesources$1.apply(analyzingcompiler.scala:142) > > @ > sbt.compiler.analyzingcompiler$$anonfun$compilesources$1.apply(analyzingcompiler.scala:139) > > @ sbt.io$.withtemporarydirectory(io.scala:291) > > @ > sbt.compiler.analyzingcompiler$.compilesources(analyzingcompiler.scala:139) > > @ sbt.compiler.ic$.compileinterfacejar(incrementalcompiler.scala:52) > > @ > org.jetbrains.jps.incremental.scala.local.compilerfactoryimpl$.getorcompileinterfacejar(compilerfactoryimpl.scala:96) > > @ > org.jetbrains.jps.incremental.scala.local.compilerfactoryimpl$$anonfun$getscalac$1.apply(compilerfactoryimpl.scala:50) > > @ > org.jetbrains.jps.incremental.scala.local.compilerfactoryimpl$$anonfun$getscalac$1.apply(compilerfactoryimpl.scala:49) > > @ scala.option.map(option.scala:146) > > @ > org.jetbrains.jps.incremental.scala.local.compilerfactoryimpl.getscalac(compilerfactoryimpl.scala:49) > > @ > org.jetbrains.jps.incremental.scala.local.compilerfactoryimpl.createcompiler(compilerfactoryimpl.scala:22) > > @ > org.jetbrains.jps.incremental.scala.local.cachingfactory$$anonfun$createcompiler$1.apply(cachingfactory.scala:24) > > @ > org.jetbrains.jps.incremental.scala.local.cachingfactory$$anonfun$createcompiler$1.apply(cachingfactory.scala:24) > > @ > org.jetbrains.jps.incremental.scala.local.cache$$anonfun$getorupdate$2.apply(cache.scala:20) > > @ scala.option.getorelse(option.scala:121) > > @ > org.jetbrains.jps.incremental.scala.local.cache.getorupdate(cache.scala:19) > > @ > org.jetbrains.jps.incremental.scala.local.cachingfactory.createcompiler(cachingfactory.scala:23) > > @ > org.jetbrains.jps.incremental.scala.local.localserver.compile(localserver.scala:22) > > @ > org.jetbrains.jps.incremental.scala.remote.main$.make(main.scala:68) > > @ > org.jetbrains.jps.incremental.scala.remote.main$.nailmain(main.scala:25) > > @ > org.jetbrains.jps.incremental.scala.remote.main.nailmain(main.scala) > > @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) > > @ > sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) > > @ > sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) > > @ java.lang.reflect.method.invoke(method.java:498) > > @ com.martiansoftware.nailgun.ngsession.run(ngsession.java:319)
Comments
Post a Comment