mumoshu / play2-memcached

A memcached plugin for Play 2.x
Other
161 stars 66 forks source link

Question : Error when running memcache #33

Open Ramzi-Alqrainy opened 9 years ago

Ramzi-Alqrainy commented 9 years ago

Hi Team,

Firstly I want to thank you about your amazing work, I am working on implementing memcache with my project [play 2.2.3 and scala 2.10.3], when I did your notes, I get this error, can you please help me ?

! @6kaia0k7k - Internal server error, for (GET) [/categories?countryCode=jo] ->

play.api.UnexpectedException: Unexpected exception[NotSerializableException: models.Setting] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:148) ~[play_2.10-2.2.3.jar:2.2.3] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:112) ~[play_2.10-2.2.3.jar:2.2.3] at scala.Option.map(Option.scala:145) ~[scala-library-2.10.3.jar:na] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112) ~[play_2.10-2.2.3.jar:2.2.3] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:110) ~[play_2.10-2.2.3.jar:2.2.3] at scala.util.Success.flatMap(Try.scala:200) ~[scala-library-2.10.3.jar:na] Caused by: java.io.NotSerializableException: models.Setting at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) ~[na:1.8.0_25] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) ~[na:1.8.0_25] at com.github.mumoshu.play2.memcached.MemcachedPlugin$CustomSerializing.serialize(MemcachedPlugin.scala:93) ~[play2-memcached_2.10-0.4.0.jar:0.4.0] at net.spy.memcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder.java:162) ~[spymemcached-2.9.0.jar:2.9.0] at net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:291) ~[spymemcached-2.9.0.jar:2.9.0] at net.spy.memcached.MemcachedClient.set(MemcachedClient.java:807) ~[spymemcached-2.9.0.jar:2.9.0]

Ramzi-Alqrainy commented 9 years ago

I think the problem is I want to store model in scala

mkubala commented 9 years ago

What exactly is models.Setting? Is it a case class, object or a regular Scala class?

Ramzi-Alqrainy commented 9 years ago

Sorry, I solved this problem by serialize the class, but I can't store collection like map / list / ... in memcache.