java.lang.IllegalStateException: Promise already completed.

JIRA | Michal B. | 12 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    There is some problem with changing result of flatMap to future: {code} val x = Observable(List("a")) val y = Observable(List("b")) val observable: Observable[String] = x.flatMap(x ⇒ y) observable.toFuture() {code} Code from above results in: {code} Promise already completed. java.lang.IllegalStateException: Promise already completed. at scala.concurrent.Promise$class.complete(Promise.scala:55) at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153) at scala.concurrent.Promise$class.success(Promise.scala:86) at scala.concurrent.impl.Promise$DefaultPromise.success(Promise.scala:153) at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anonfun$toFuture$1.apply(ObservableImplicits.scala:332) at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anonfun$toFuture$1.apply(ObservableImplicits.scala:332) at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anon$1.onNext(ObservableImplicits.scala:88) at org.mongodb.scala.internal.MapObservable$$anon$1.onNext(MapObservable.scala:32) at org.mongodb.scala.internal.FoldLeftObservable$$anon$1.onComplete(FoldLeftObservable.scala:35) at org.mongodb.scala.internal.FlatMapObservable$$anon$1.onComplete(FlatMapObservable.scala:71) at org.mongodb.scala.internal.IterableObservable$$anon$1.request(IterableObservable.scala:46) at org.mongodb.scala.internal.FlatMapObservable$$anon$1$$anon$2.request(FlatMapObservable.scala:54) at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anon$1.onSubscribe(ObservableImplicits.scala:86) at org.mongodb.scala.internal.MapObservable$$anon$1.onSubscribe(MapObservable.scala:28) at org.mongodb.scala.internal.FoldLeftObservable$$anon$1.onSubscribe(FoldLeftObservable.scala:32) at org.mongodb.scala.internal.FlatMapObservable$$anon$1.onSubscribe(FlatMapObservable.scala:66) ... {code} I'm using mongo-scala-driver 1.1.0 and MongoDB server 3.2.3. In debug it looks like onNext is executed once again after onComplete.

    JIRA | 12 months ago | Michal B.
    java.lang.IllegalStateException: Promise already completed.
  2. 0

    There is some problem with changing result of flatMap to future: {code} val x = Observable(List("a")) val y = Observable(List("b")) val observable: Observable[String] = x.flatMap(x ⇒ y) observable.toFuture() {code} Code from above results in: {code} Promise already completed. java.lang.IllegalStateException: Promise already completed. at scala.concurrent.Promise$class.complete(Promise.scala:55) at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153) at scala.concurrent.Promise$class.success(Promise.scala:86) at scala.concurrent.impl.Promise$DefaultPromise.success(Promise.scala:153) at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anonfun$toFuture$1.apply(ObservableImplicits.scala:332) at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anonfun$toFuture$1.apply(ObservableImplicits.scala:332) at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anon$1.onNext(ObservableImplicits.scala:88) at org.mongodb.scala.internal.MapObservable$$anon$1.onNext(MapObservable.scala:32) at org.mongodb.scala.internal.FoldLeftObservable$$anon$1.onComplete(FoldLeftObservable.scala:35) at org.mongodb.scala.internal.FlatMapObservable$$anon$1.onComplete(FlatMapObservable.scala:71) at org.mongodb.scala.internal.IterableObservable$$anon$1.request(IterableObservable.scala:46) at org.mongodb.scala.internal.FlatMapObservable$$anon$1$$anon$2.request(FlatMapObservable.scala:54) at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anon$1.onSubscribe(ObservableImplicits.scala:86) at org.mongodb.scala.internal.MapObservable$$anon$1.onSubscribe(MapObservable.scala:28) at org.mongodb.scala.internal.FoldLeftObservable$$anon$1.onSubscribe(FoldLeftObservable.scala:32) at org.mongodb.scala.internal.FlatMapObservable$$anon$1.onSubscribe(FlatMapObservable.scala:66) ... {code} I'm using mongo-scala-driver 1.1.0 and MongoDB server 3.2.3. In debug it looks like onNext is executed once again after onComplete.

    JIRA | 12 months ago | Michal B.
    java.lang.IllegalStateException: Promise already completed.
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Observable.zip throws exception on complete

    GitHub | 10 months ago | alexandru
    java.lang.IllegalStateException: Promise already completed.
  5. 0

    NPE in ThrottlerTransportAdapter

    GitHub | 2 years ago | patriknw
    akka.actor.PostRestartException: exception post restart (class java.lang.NullPointerException)

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Promise already completed.

      at scala.concurrent.Promise$class.complete()
    2. Scala
      Promise$DefaultPromise.success
      1. scala.concurrent.Promise$class.complete(Promise.scala:55)
      2. scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153)
      3. scala.concurrent.Promise$class.success(Promise.scala:86)
      4. scala.concurrent.impl.Promise$DefaultPromise.success(Promise.scala:153)
      4 frames
    3. org.mongodb.scala
      FlatMapObservable$$anon$1.onSubscribe
      1. org.mongodb.scala.ObservableImplicits$ScalaObservable$$anonfun$toFuture$1.apply(ObservableImplicits.scala:332)
      2. org.mongodb.scala.ObservableImplicits$ScalaObservable$$anonfun$toFuture$1.apply(ObservableImplicits.scala:332)
      3. org.mongodb.scala.ObservableImplicits$ScalaObservable$$anon$1.onNext(ObservableImplicits.scala:88)
      4. org.mongodb.scala.internal.MapObservable$$anon$1.onNext(MapObservable.scala:32)
      5. org.mongodb.scala.internal.FoldLeftObservable$$anon$1.onComplete(FoldLeftObservable.scala:35)
      6. org.mongodb.scala.internal.FlatMapObservable$$anon$1.onComplete(FlatMapObservable.scala:71)
      7. org.mongodb.scala.internal.IterableObservable$$anon$1.request(IterableObservable.scala:46)
      8. org.mongodb.scala.internal.FlatMapObservable$$anon$1$$anon$2.request(FlatMapObservable.scala:54)
      9. org.mongodb.scala.ObservableImplicits$ScalaObservable$$anon$1.onSubscribe(ObservableImplicits.scala:86)
      10. org.mongodb.scala.internal.MapObservable$$anon$1.onSubscribe(MapObservable.scala:28)
      11. org.mongodb.scala.internal.FoldLeftObservable$$anon$1.onSubscribe(FoldLeftObservable.scala:32)
      12. org.mongodb.scala.internal.FlatMapObservable$$anon$1.onSubscribe(FlatMapObservable.scala:66)
      12 frames