Using Jedis' API with NoSuchMethodError

1,375 views
Skip to first unread message

Marvin

unread,
Jan 6, 2012, 3:00:13 AM1/6/12
to Jedis
Hi!
I am using Jedis 1.5.2 and RedisStore for session handling. There
is a problem when I was using some methods such as "jedis.exists",
"jedis.hset", "jedis.renamenx" and "jedis.lpush"...etc. Those
function(or method) can be implemented and compiled under eclipse.
However, a nosuchmethod-error will occur when my application is
running on the server using tomcat 7.0.23. Besides, other functions
such as "jedis.set", "jedis.hmset" ,"jedis.rename" and "jedis.ping"...
are working properly.
In conclusion, only part of the Jedis' API with return type String
or Void are working. Others with return type Boolean and Long will
cause a NoSuchMethod error. The exception message and root cause are
as follow:

exception

javax.servlet.ServletException:
com.sun.jersey.api.container.MappableContainerException:
java.lang.NoSuchMethodError: redis.clients.jedis.Jedis.renamenx(Ljava/
lang/String;Ljava/lang/String;)Ljava/lang/Long;

com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:
361)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause
com.sun.jersey.api.container.MappableContainerException:
java.lang.NoSuchMethodError: redis.clients.jedis.Jedis.renamenx(Ljava/
lang/String;Ljava/lang/String;)Ljava/lang/Long;

com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:
74)

com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:
124)

com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:
71)

com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:
111)

com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:
63)

com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:
555)

com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:
514)

com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:
505)

com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:
359)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


If this is not an error, what am I doing wrong?
Or someone can give me a little tips for solution.
Thanks!

best regards,
Marvin

Marvin

unread,
Jan 9, 2012, 2:35:55 AM1/9/12
to Jedis
I have solved this problem by myself. Since I was using RedisStore for
session handling, I've modified the pom.xml by adding the jmock. When
I remove the jmock package and rebuild the repository, the exception
is gone. I think this is the root cause of no-such-method exception.

Reply all
Reply to author
Forward
0 new messages