mumoshu/play2-memcached

Exception during starting memcached in Play2.3.7

Opened this issue · 5 comments

Hi,

Firstly, thanks for such a great plugin and the good work you are doing.
I am trying to use memcached in my project (play2.3.7, java8) and using this plugin version 0.7.0 (play2-memcached-play23_2.11-0.7.0) along with spymemcached-2.9.1 but I get the following exception and application fails to start. I need to get this up and going as my project is going live shortly.

play.api.Application$$anon$1: Execution exception[[NullPointerException: null]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.7.jar:2.3.7]
at scala.Option.map(Option.scala:145) [scala-library-2.11.1.jar:na]
Caused by: java.lang.NullPointerException: null
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anon$2.get(MemcachedPlugin.scala:106) ~[play2-memcached-play23_2.11-0.7.0.jar:0.7.0]
at play.api.cache.Cache$.get(Cache.scala:80) ~[play-cache_2.11-2.3.7.jar:2.3.7]
at play.api.cache.Cache.get(Cache.scala) ~[play-cache_2.11-2.3.7.jar:2.3.7]
at play.cache.Cache.get(Cache.java:19) ~[play-cache_2.11-2.3.7.jar:2.3.7]

Looking forward for your help in resolving this issue.

Regards,
Irshad

@irshad-k Hi, thanks for your interest in the plugin :)

Did you pass nulls as keys to Cache.get?
If so, please don't.
You should always pass non null string values to Cache.get because keys are necessary to communicate with key-value stores like Memcached.

Regards,
Yusuke

Hi @irshad-k!
Could you get your issue resolved?
Don't hesitate to reopen this issue if not.

The issue is not with passing null as key.. I have been using this plugin since play 2.1 and version 0.30 and everything was working fine.. Now I upgraded to play 2.3.7 and memcached 0.7.0 and everything just stops working and I get this above posted stack trace..
Now, I have rolled back to play 2.1 until this issue is resolved.

Could you please reopen the issue..I m not able to find the button or link to reopen the issue.
Thanks

@irshad-k Thanks for your response! I've reopened this issue.

I wonder if I've missed something, but the stack trace you've shared:

Caused by: java.lang.NullPointerException: null
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anon$2.get(MemcachedPlugin.scala:106) ~[play2-memcached-play23_2.11-0.7.0.jar:0.7.0]

seems to point this line as the source of NullPointerException:

https://github.com/mumoshu/play2-memcached/blob/v0.7.0/plugin/src/main/default/com/github/mumoshu/play2/memcached/MemcachedPlugin.scala#L106

Could I have an example Play2 app to reproduce the issue without null keys?