mumoshu/play2-memcached

NoSuchFieldError: TRACE when used with elasticache.

timscarborough opened this issue · 3 comments

When setting the app dependency for play2-memcached with AWS elasticache as described in the readme, I get a NoSuchFieldError: TRACE when running my application. I have the AWS elasticache client jar in my lib folder and I excluded net.spy as described in the documentation ("com.github.mumoshu" %% "play2-memcached" % "0.5.0-RC1 exclude("net.spy", "spymemcached")). Am I missing something? Any assistance would be greatly appreciated. Thanks!

Same here. I am using version 0.6.0 with play 2.3.3.
Problem seems related to the logging mechanism of net.spy.memcached. I also tried to upgrade spymemcached to the newest release 2.11.4. The error remains.
Stacktrace:
Exception in thread "main" java.lang.NoSuchFieldError: TRACE
at com.github.mumoshu.play2.memcached.Slf4JLogger.log(MemcachedPlugin.scala:26)
at net.spy.memcached.compat.log.AbstractLogger.info(AbstractLogger.java:118)
at net.spy.memcached.compat.log.AbstractLogger.info(AbstractLogger.java:129)
at net.spy.memcached.MemcachedConnection.createConnections(MemcachedConnection.java:247)
at net.spy.memcached.MemcachedConnection.(MemcachedConnection.java:182)
at net.spy.memcached.DefaultConnectionFactory.createConnection(DefaultConnectionFactory.java:203)
at net.spy.memcached.MemcachedClient.setupConnection(MemcachedClient.java:338)
at net.spy.memcached.MemcachedClient.initializeClientUsingConfigEndPoint(MemcachedClient.java:300)
at net.spy.memcached.MemcachedClient.(MemcachedClient.java:284)
at net.spy.memcached.MemcachedClient.(MemcachedClient.java:215)
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anonfun$client$2$$anonfun$apply$2.apply(MemcachedPlugin.scala:72)
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anonfun$client$2$$anonfun$apply$2.apply(MemcachedPlugin.scala:72)
at scala.Option.getOrElse(Option.scala:120)
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anonfun$client$2.apply(MemcachedPlugin.scala:71)
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anonfun$client$2.apply(MemcachedPlugin.scala:45)
at scala.Option.getOrElse(Option.scala:120)
at com.github.mumoshu.play2.memcached.MemcachedPlugin.client$lzycompute(MemcachedPlugin.scala:45)
at com.github.mumoshu.play2.memcached.MemcachedPlugin.client(MemcachedPlugin.scala:40)
at com.github.mumoshu.play2.memcached.MemcachedPlugin.onStart(MemcachedPlugin.scala:178)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
at scala.collection.immutable.List.foreach(List.scala:383)
at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.api.Play$.start(Play.scala:90)
at play.core.StaticApplication.(ApplicationProvider.scala:55)
at play.core.server.NettyServer$.createServer(NettyServer.scala:244)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:280)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:275)
at scala.Option.map(Option.scala:145)
at play.core.server.NettyServer$.main(NettyServer.scala:275)
at play.core.server.NettyServer.main(NettyServer.scala)

Could identify the problem. The Amazon ElastiCache library serves an outdated Logger implementation that is not compatible with the updated Memcached Play Plugin (particularly the class net.spy.memcached.compat.log.Level).

I created a fork of the Amazon ElastiCache library and updated the logging related files and corresponding dependencies: https://github.com/mugglmenzel/aws-elasticache-cluster-client-memcached-for-java
Feel free to clone to compile with ant. Will also trigger a pull request.