package models
import play.api.libs.json.{Json, OFormat}
import reactivemongo.bson.{BSONLong, BSONObjectID}
case class SavedPostOrBlog(
_id:Option[BSONObjectID],
postOrBlogId:BSONObjectID,
discussGroupId:Option[BSONObjectID],
saverId:BSONObjectID,
isQPost:Option[Boolean]=None,
isArticle:Option[Boolean]=None,
test : BSONLong = BSONLong.apply(12334)
)
object SavedPostOrBlogJsonFormat{
import reactivemongo.play.json._
implicit val spb: OFormat[SavedPostOrBlog] = Json.format[SavedPostOrBlog]
}
[error] a.a.ActorSystemImpl - Uncaught error from thread [application-dbContext-
dispatcher-37]: models.SavedPostOrBlog.<init>(Lscala/Option;Lreactivemongo/bson/BSONObjectID;Lscala/Option;Lreactivemongo/bson/BSONObjectID;Lscala/Option;Lscala/Option;)V, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application]
java.lang.NoSuchMethodError: models.SavedPostOrBlog.<init>(Lscala/Option;Lreactivemongo/bson/BSONObjectID;Lscala/Option;Lreactivemongo/bson/BSONObjectID;Lscala/Option;Lscala/Option;)V
at controllers.postActions.SavePostController.$anonfun$savePost$8(SavePostController.scala:96)
at controllers.postActions.SavePostController.checkDGroupMemberShip(SavePostController.scala:157)
at controllers.postActions.SavePostController.$anonfun$savePost$4(SavePostController.scala:93)
at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:433)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:92)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:92)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
[info] p.c.s.AkkaHttpServer - Stopping server...
[info] p.m.r.DefaultReactiveMongoApi - ReactiveMongoApi stopping...
[INFO] [04/02/2020 12:49:00.178] [reactivemongo-akka.actor.default-dispatcher-12] [akka://reactivemongo/user/Connection-1] Message [reactivemongo.core.actors.ChannelDisconnected] without sender to Actor[akka://reactivemongo/user/Connection-1#1685282110] was not delivered. [1] dead letters encountered. If this is not an expected behavior, then [Actor[akka://reactivemongo/user/Connection-1#1685282110]] may have terminated unexpectedly, This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[info] r.c.a.MongoDBSystem - [Supervisor-2/Connection-1] Stopping the MongoDBSystem
[info] p.m.r.DefaultReactiveMongoApi - ReactiveMongoApi connections are stopped
[info] r.api.Driver - [Supervisor-2] Closing instance of ReactiveMongo driver
[info] r.api.Driver - [Supervisor-2] Stopping the monitor...
[DEBUG] [04/02/2020 12:49:00.182] [reactivemongo-akka.actor.default-dispatcher-2] [EventStream] shutting down: StandardOutLogger
[info] r.c.n.ChannelFactory - [Supervisor-2/Connection-1] Cannot create channel to '127.0.0.1:27017' from inactive factory
[warn] r.c.a.MongoDBSystem - [Supervisor-2/Connection-1] Cannot create connection for Node(127.0.0.1:27017,Primary,Vector(Connection([id: 0x03a83e6d, L:0.0.0.0/0.0.0.0:58166 ! R:/127.0.0.1:27017],Connecting,Set(Authenticated(admin,dbReadWrite)),None)),Set(Authenticated(admin,dbReadWrite)),None,ProtocolMetadata(2.6, 3.6),PingInfo(6760584, 0, -1, None),false)
reactivemongo.core.errors.GenericDriverException: MongoError['Cannot create channel to '127.0.0.1:27017' from inactive factory (Supervisor-2/Connection-1)']
Без свойства test
в SavedPostOrBlog
запрос модели выполняется нормально, но когда я добавляю свойство test BSONLong
, jvm cra sh.
Вот запрос:
def createDocument(postOrBlogId: BSONObjectID,
saverId: BSONObjectID, savedPostOrBlog: SavedPostOrBlog): Future[UpdateWriteResult] =
collection.map(_.update(true).one(Json.obj("postOrBlogId" -> postOrBlogId, "saverId" -> saverId), savedPostOrBlog, upsert = true)).flatten
Зависимость реактива go: "org.reactivemon go" %% "play2 -activetivemon go"% "0.18.4-play27"