My whole actor code

class Getter(url: String, depth: Int, id: ActorRef) extends Actor {

  implicit val executor = context.dispatcher.asInstanceOf[Executor with 
ExecutionContext]
  def client: WebClient = AsyncWebClient

  client get url pipeTo self

  def receive = {
    case body: String =>
      // Database
      import reactivemongo.api.MongoDriver
      import reactivemongo.api.collections.default._
      import reactivemongo.api._
      import reactivemongo.bson._
      import scala.concurrent.ExecutionContext.Implicits.global
      import scala.concurrent.Future
      import scala.util.{Try, Success, Failure}

      val driver = new MongoDriver
      val connection = driver.connection(List("localhost"))
      val db = connection.db("urldb")
      val collection = db.collection("urlcoll")
      val document = BSONDocument(
        "url" -> BSONString(url),
        "body" -> BSONString(body))
      val future = collection.insert(document)
      future.onComplete {
        case Failure(e) => throw e
        case Success(lastError) => {
          println("successfully inserted document with lastError = " + 
lastError)
        }
      }

      //println("Content => " + body + id.toString)
      context.stop(self)
    case _: Status.Failure => context.stop(self)
  }
}

On Monday, January 13, 2014 3:55:43 PM UTC+5:30, Björn Antonsson wrote:
>
>  Hi, 
>
> The log output says that it fails creating an actor.
>
> There is just to much missing from you code and the logs to say anything 
> more useful. Could you please provide more information?
>
> B/
>
> On Monday, 13 January 2014 at 09:28, [email protected] <javascript:>wrote:
>
> I wrote this code this is a recieve function of an actor,
>
> def receive = {
>     case body: String =>      
>       import reactivemongo.api.MongoDriver
>       import reactivemongo.api.collections.default._
>       import reactivemongo.api._
>       import reactivemongo.bson._
>       import scala.concurrent.ExecutionContext.Implicits.global
>       import scala.concurrent.Future
>       import scala.util.{Try, Success, Failure}
>
>       val driver = new MongoDriver
>       val connection = driver.connection(List("localhost"))
>       val db = connection.db("urldb")
>       val collection = db.collection("urlcoll")
>       val document = BSONDocument(
>         "url" -> BSONString(url),
>         "body" -> BSONString(body))
>       val future = collection.insert(document)
>       future.onComplete {
>         case Failure(e) => throw e
>         case Success(lastError) => {
>           println("successfully inserted document with lastError = " + 
> lastError)
>         }
>       }
>
> Is there a problem ?
> I get this error
>
> Uncaught error from thread [reactivemongo-akka.actor.default-dispatcher-6] 
> shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for 
> ActorSystem[reactivemongo]
>
> java.lang.AbstractMethodError
>
> at akka.actor.ActorCell.create(ActorCell.scala:555)
>
> at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:431)
>
> at akka.actor.ActorCell.systemInvoke(ActorCell.scala:453)
>
> at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:262)
>
> at akka.dispatch.Mailbox.run(Mailbox.scala:218)
>
> at 
> akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:385)
>
> at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
>
> at 
> scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
>
> at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
>
> at 
> scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
>
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]<javascript:>
> .
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> -- 
> Björn Antonsson
> Typesafe <http://typesafe.com/> – Reactive Apps on the JVM
> twitter: @bantonsson <http://twitter.com/#!/bantonsson>
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://akka.io/faq/
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to