KarelCemus / play-redis

Play framework 2 cache plugin as an adapter to redis-server
Mozilla Public License 2.0
164 stars 44 forks source link

play.api.cache.redis - Deserialization failed for key 'facets' #236

Closed cgawade closed 4 years ago

cgawade commented 4 years ago

Are you filing an issue? Please follow these checklists and provide us all the possible information to speed up the process.

Reporting a bug?

  1. Version of play-redis 2.6.1
  2. Version of Scala 2.12.10
  3. Version of Play 2.7.4
  4. Describe the environment if applies (usually in cloud etc.) local
  5. Describe the expected behavior
  6. Describe the actual behavior, follow the same scenario
  7. Provide instructions to reproduce the issue

Proposing a feature?

  1. Describe the new feature
  2. Propose the use if applies, i.e., the public API and how to integrate with the application

When i try to read custom object from the redis cache getting exception. Code val result: SynchronousResult[Future[Facets]] = localCache.getOrElse[Future[Facets]]("facets")(facets.getFacetsLines)

15:03:07.975 [application-akka.actor.default-dispatcher-4] ERROR play.api.cache.redis - Deserialization failed for key 'facets'. java.io.NotSerializableException: No configured serialization-bindings for class [scala.concurrent.Future] at akka.serialization.Serialization.serializerFor(Serialization.scala:332) at akka.serialization.Serialization.$anonfun$deserialize$7(Serialization.scala:296) at scala.util.Try$.apply(Try.scala:213) at akka.serialization.Serialization.$anonfun$deserialize$6(Serialization.scala:296) at akka.serialization.Serialization.withTransportInformation(Serialization.scala:173) at akka.serialization.Serialization.deserialize(Serialization.scala:295) at play.api.cache.redis.connector.AkkaDecoder.binaryToAnyRef(AkkaSerializer.scala:122) at play.api.cache.redis.connector.AkkaDecoder.$anonfun$stringToAnyRef$2(AkkaSerializer.scala:126) at scala.Function1.$anonfun$andThen$1(Function1.scala:57) at play.api.cache.redis.connector.AkkaDecoder.stringToAnyRef(AkkaSerializer.scala:126) at play.api.cache.redis.connector.AkkaDecoder.untypedDecode(AkkaSerializer.scala:113) at play.api.cache.redis.connector.AkkaDecoder.decode(AkkaSerializer.scala:97) at play.api.cache.redis.connector.AkkaSerializerImpl.$anonfun$decode$1(AkkaSerializer.scala:165) at scala.util.Try$.apply(Try.scala:213) at play.api.cache.redis.connector.AkkaSerializerImpl.decode(AkkaSerializer.scala:165) at play.api.cache.redis.connector.RedisConnectorImpl.play$api$cache$redis$connector$RedisConnectorImpl$$decode(RedisConnectorImpl.scala:55) at play.api.cache.redis.connector.RedisConnectorImpl$$anonfun$get$1.applyOrElse(RedisConnectorImpl.scala:34) at play.api.cache.redis.connector.RedisConnectorImpl$$anonfun$get$1.applyOrElse(RedisConnectorImpl.scala:31) at scala.PartialFunction$OrElse.apply(PartialFunction.scala:172) at scala.util.Success.$anonfun$map$1(Try.scala:255) at scala.util.Success.map(Try.scala:213) at scala.concurrent.Future.$anonfun$map$1(Future.scala:292) at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33) at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) 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.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:92) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:49) at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

ihostage commented 4 years ago

Try to get a Future from the cache looks very strange. 🤔 If you want to use a Future in your code, you should be using a CacheAsyncApi instead CacheApi.

cgawade commented 4 years ago

My bad Thanks for response