5
votes

I tried upgrading to reactive mongo 0.12.1 with play 2.5.12 but when I run the JVM quits on me and I get the following stack trace:

Uncaught error from thread [application-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application] java.lang.NoClassDefFoundError: play/api/libs/concurrent/StateMachine at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at play.api.libs.streams.impl.EnumeratorSubscriptionFactory$class.createSubscription(EnumeratorPublisher.scala:25) at play.api.libs.streams.impl.EnumeratorPublisher.createSubscription(EnumeratorPublisher.scala:33) at play.api.libs.streams.impl.EnumeratorPublisher.createSubscription(EnumeratorPublisher.scala:33) at play.api.libs.streams.impl.RelaxedPublisher.subscribe(RelaxedPublisher.scala:19) at akka.stream.impl.MaterializerSession.akka$stream$impl$MaterializerSession$$doSubscribe(StreamLayout.scala:1033) at akka.stream.impl.MaterializerSession.assignPort(StreamLayout.scala:1025) at akka.stream.impl.MaterializerSession$$anonfun$exitScope$2.apply(StreamLayout.scala:907) at akka.stream.impl.MaterializerSession$$anonfun$exitScope$2.apply(StreamLayout.scala:906) at scala.collection.Iterator$class.foreach(Iterator.scala:893) at scala.collection.AbstractIterator.foreach(Iterator.scala:1336) at akka.stream.impl.MaterializerSession.exitScope(StreamLayout.scala:906) at akka.stream.impl.MaterializerSession$$anonfun$materializeModule$1.apply(StreamLayout.scala:958) at akka.stream.impl.MaterializerSession$$anonfun$materializeModule$1.apply(StreamLayout.scala:950) at scala.collection.immutable.Set$Set3.foreach(Set.scala:163) at akka.stream.impl.MaterializerSession.materializeModule(StreamLayout.scala:950) at akka.stream.impl.MaterializerSession.materialize(StreamLayout.scala:917) at akka.stream.impl.ActorMaterializerImpl.materialize(ActorMaterializerImpl.scala:256) at akka.stream.impl.ActorMaterializerImpl.materialize(ActorMaterializerImpl.scala:146) at akka.stream.scaladsl.RunnableGraph.run(Flow.scala:350) at akka.stream.scaladsl.Source.runWith(Source.scala:81) at play.core.server.netty.NettyModelConversion.play$core$server$netty$NettyModelConversion$$createChunkedResponse(NettyModelConversion.scala:256) at play.core.server.netty.NettyModelConversion$$anonfun$convertResult$1.apply(NettyModelConversion.scala:189) at play.core.server.netty.NettyModelConversion$$anonfun$convertResult$1.apply(NettyModelConversion.scala:166) at play.core.server.common.ServerResultUtils$.resultConversionWithErrorHandling(ServerResultUtils.scala:127) at play.core.server.netty.NettyModelConversion.convertResult(NettyModelConversion.scala:235) at play.core.server.netty.PlayRequestHandler$$anonfun$play$core$server$netty$PlayRequestHandler$$handleAction$2$$anonfun$apply$3.apply(PlayRequestHandler.scala:273) at play.core.server.netty.PlayRequestHandler$$anonfun$play$core$server$netty$PlayRequestHandler$$handleAction$2$$anonfun$apply$3.apply(PlayRequestHandler.scala:267) at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253) at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) at play.api.libs.iteratee.Execution$trampoline$.executeScheduled(Execution.scala:110) at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:70) at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40) at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:248) at scala.concurrent.Promise$class.complete(Promise.scala:55) at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153) at scala.concurrent.Future$$anonfun$andThen$1.apply(Future.scala:436) at scala.concurrent.Future$$anonfun$andThen$1.apply(Future.scala:435) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91) at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91) at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:415) 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) Caused by: java.lang.ClassNotFoundException: play.api.libs.concurrent.StateMachine

Any help will be appreciated!

1
Make sure there is no issue with the Iteratees dependency pulled. ReactiveMongo for Play expect it to be provided by Play itself, from 2.4 to 2.6.cchantep
Thank you. It was exactly the problem! I ended up excluding iteratees from reactivemongo - "org.reactivemongo" %% "play2-reactivemongo" % reactiveMongoVersion excludeAll( ExclusionRule("com.typesafe.play", "play-iteratees_2.11") // This is needed - otherewise version 2.6.1 overrides everything and kills play ),YaDa
Play ReactiveMongo already exclude the play dependencies, so this should not be the causecchantep

1 Answers

7
votes

After examining the dependencies graph (https://github.com/jrudolph/sbt-dependency-graph), What ended up working for me is to exclude play-iteratees from ReactiveMongo.

In my build.sbt, change the import to:

"org.reactivemongo" %% "play2-reactivemongo" % reactiveMongoVersion excludeAll( ExclusionRule("com.typesafe.play", "play-iteratees_2.11")