Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError when using lettuce 6.x #49

Closed
xenomachina opened this issue Jan 13, 2021 · 3 comments
Closed

java.lang.NoSuchMethodError when using lettuce 6.x #49

xenomachina opened this issue Jan 13, 2021 · 3 comments

Comments

@xenomachina
Copy link

It looks like lettuce 6.x introduced a binary incompatibility that makes ratelimitj break at runtime.

The breakage we're running into is that RedisScriptLoader calls RedisScriptingReactiveCommands.scriptLoad, and this changed from being a single method with the signature Mono<String> scriptLoad(V script) to a pair of methods, Mono<String> scriptLoad(String script) and Mono<String> scriptLoad(byte[] script).

This change appears to be source compatible with ratelimitj. I tried changing ratelimitj's dependency on lettuce from io.lettuce:lettuce-core:5.3.4.RELEASE to io.lettuce:lettuce-core:6.0.2.RELEASE, and ./gradlew ratelimitj-redis:check builds and passes with the new version of lettuce.

@Akaame
Copy link

Akaame commented Jan 12, 2022

I think this has been already covered by

From this to this and is available from 0.7.0 release on.

@sycz
Copy link

sycz commented Jun 6, 2022

I have the same problem. 0.7.0 Incompatible with lettuce-core:5.3.7.

es.moki.ratelimitj.redis.request.RedisScriptLoader.loadScript()

java.lang.NoSuchMethodError: io.lettuce.core.api.reactive.RedisScriptingReactiveCommands.scriptLoad(Ljava/lang/String;)Lreactor/core/publisher/Mono;

I compared the two versions(ratelimitj-redis 0.7.0-RC3 / 0.7.0) and found that they were basically the same. Except this:

.retry(1, RedisSlidingWindowRequestRateLimiter::startWithNoScriptError)

.retryWhen(Retry.max(1).filter(RedisSlidingWindowRequestRateLimiter::startWithNoScriptError))

ratelimitj-core doesn't change anything.

But if you run it(ratelimitj-redis:0.7.0) in source code, it works.

I think it(NoSuchMethodError) should not be affected by dependencies.

I wonder what caused it.

@xenomachina
Copy link
Author

The incompatibility with lettuce-core 6.x was fixed in f37eb87, when the dependency on lettuce-core was upgraded from 5.3.4 to 6.0.2, so this issue is resolved as reported.

However, the fix means that users of ratelimitj need to also upgrade lettuce-core 6.x.

@sycz I don't know about now, but back when I reported this issue, the incompatibility wouldn't bite you if you built ratelimitj yourself, because the change that was made to lettuce-core was still source-compatible with ratelimitj, just not binary compatible with anything that used the scriptLoad method from the "wrong" version. Can you upgrade your lettuce-core dependency to 6.x? (The current release is 6.1.8.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants