Skip to content

[Bug]:Class org.redisson.api.RScript$ReturnType does not have member field 'org.redisson.api.RScript$ReturnType LONG' #3063

Open

Description

@xiaoshuai288

问题描述

在使用 RedisAgentStateStore 进行 Agent 状态持久化测试时,运行抛出 NoSuchFieldError。
异常发生在框架内部 RedissonClientAdapter.evalScript() 方法,代码硬编码使用 RScript.ReturnType.LONG。
agentscope 2.0.3 的 jar 包通过 shade 内嵌了一份旧版 Redisson 类,内嵌版本的RScript.ReturnType枚举不存在 LONG 常量。
虽然项目 POM 已经引入 Redisson 3.52.0(该版本包含 LONG 枚举),但是 JVM 类加载优先加载 AgentScope jar 内自带的旧 Redisson 类,编译正常,运行时报字段缺失。业务代码无法修改框架源码。

复现步骤

  1. 创建 SpringBoot 3.5.11 项目,pom 引入依赖:io.agentscope:agentscope:2.0.3、redisson-spring-boot-starter:3.52.0
  2. 使用框架提供的 RedisAgentStateStore 实现 Agent 状态持久化
  3. 启动项目,触发状态持久化逻辑,底层会调用 RedissonClientAdapter.evalScript 执行 Lua 脚本
  4. 抛出 NoSuchFieldError 异常

预期行为

RedisAgentStateStore 正常执行 Lua 脚本完成 Agent 状态持久化;框架内嵌 Redisson 不应该和项目引入的 Redisson 发生类冲突。

报错信息

java.lang.NoSuchFieldError: No static field LONG of type Lorg/redisson/api/RScript$ReturnType;
	at io.agentscope.adapter.RedissonClientAdapter.evalScript(RedissonClientAdapter.java:228)
	at io.agentscope.storage.redis.RedisAgentStateStore.[相关持久化方法]

异常发生在虚拟线程,调用链路来自RedisAgentStateStore持久化流程。

运行环境

  • AgentScope-Java Version:2.0.3
  • Java Version:21
  • OS:Windows

补充说明

  1. Maven 依赖树显示项目依赖 Redisson 3.52.0,该版本RScript.ReturnType包含 LONG 枚举,版本本身没问题。
  2. 冲突根本原因:agentscope-2.0.3.jar使用 shade 打包内嵌旧 Redisson,未做包名 relocation 隔离;Maven 依赖树无法识别这种内嵌在 jar 里的 class。
  3. JVM 优先加载 agentscope 包内旧的org.redisson.api.RScript$ReturnType,该枚举缺少 LONG 常量。
  4. 触发场景:RedisAgentStateStore持久化 Agent 状态,底层调用RedissonClientAdapter.evalScript执行 Lua 脚本触发异常。
  5. 建议修复方案二选一:
    • 移除 shade 内嵌 Redisson,改用 Maven 正常依赖管理;
    • 对内置 Redisson 做包名重定向(relocation),避免与业务项目引入的 Redisson 产生类冲突。

Activity

  1. added
    bug
    on Sep 9, 2026
  2. oss-maintainer commented on Sep 11, 2026

    @oss-maintainer
    Collaborator

    Issue Evaluation

    Category: bug | Status: Confirmed (root cause differs from the report)

    Verified against the published io.agentscope:agentscope:2.0.3 artifact on Maven Central and main @ c5db8f7.

    What we found:

    • The NoSuchFieldError: RScript$ReturnType.LONG is genuine. RScript.ReturnType.INTEGER was renamed to LONG in Redisson 4.x; 3.x jars have no LONG field. Framework code uses the 4.x API (RedissonClientAdapter.java:228, RedissonAgentStateStore.java:153 on main; the RedissonClientAdapter.class inside the published agentscope-2.0.3.jar references ReturnType.LONG as well).
    • Correction to the reported root cause: we inspected agentscope-2.0.3.jar directly — it contains zero org/redisson/** classes, so nothing is embedded/shaded-unrelocated. The only top-level package is io/agentscope/.
    • Actual root cause: the published aggregate agentscope-2.0.3.jar does bundle the Redis extension classes (io/agentscope/extensions/redis/state/redisson/*.class), but its POM declares no org.redisson dependency at all (only harness/jackson/okhttp/mcp/reactor/jsonschema). So the bundled Redisson-based code runs against whatever Redisson the user happens to place on the classpath — here redisson-spring-boot-starter:3.52.0 → Redisson 3.x, whose ReturnType lacks LONG. This is the same packaging drift behind [Bug]: #3010合并后agentscope-all 聚合包通过 agentscope-spring-boot-starter 传递依赖,导致 classpath 出现重复类,运行时加载旧版代码(shade 产物与模块版本不同步) #3083 (aggregate contents out of sync with module releases).

    Impact: anyone using RedisAgentStateStore via the aggregate artifact with a self-managed Redisson 3.x fails at first state persist with a raw NoSuchFieldError. Severity: medium-high (runtime crash, non-obvious cause, undeclared dependency).

    Fix proposal (packaging decision involved, so flagged before a PR):

    1. Make the published aggregate honest: either declare the Redisson dependency it actually requires (with a supported version range), or stop bundling extensions/redis classes in the aggregate and ship them only as the standalone agentscope-extensions-redis module (aligned with the [Bug]: #3010合并后agentscope-all 聚合包通过 agentscope-spring-boot-starter 传递依赖,导致 classpath 出现重复类,运行时加载旧版代码(shade 产物与模块版本不同步) #3083 direction).
    2. Add a fail-fast compatibility guard in the Redisson store init (probe ReturnType.LONG / implementation version) that raises a clear message like "agentscope Redis extension requires Redisson >= 4.x; found X".
    3. Document the minimum Redisson version for Redis-backed state persistence.

    User-side workaround today: align Redisson with the version agentscope was built against — org.redisson:redisson:4.2.0 (or import agentscope-dependencies-bom), instead of letting redisson-spring-boot-starter:3.52.0 resolve Redisson 3.x.

    An automated fix proposal can be generated for the guard + dependency-declaration part. Reply /approve to proceed with PR generation (the aggregate-packaging change itself is queued behind the maintainer decision in #3083).


    Automated evaluation by github-manager-bot

  3. oss-maintainer commented on Sep 12, 2026

    @oss-maintainer
    Collaborator

    Adjacent-PR advisory — no change to the evaluation above (supplementary context; the reply window above stays open)

    While re-checking the open-PR queue against this proposal window, a new community PR appeared that overlaps part of what the /approve call-to-action above advertises:

    • fix: fail early for incompatible Redisson state-store clients #3112 (open, non-draft, @mvanhorn, opened 2026-09-12T12:33:50Z) — fix: fail early for incompatible Redisson state-store clients, Fixes #3063. It implements item 2 of the proposal above — a construction-time capability probe that resolves RScript.ReturnType by name and raises an actionable IllegalStateException when a Redisson 3.x API is on the classpath, wired through both RedissonAgentStateStore and RedissonClientAdapter — plus item 3 (minimum-version docs across the four docs/v2/{en,zh}/integration/{distributed,session}/redis.md pages) and unit tests for both classes.

    What #3112 does not cover: item 1. No pom.xml/BOM file is touched, so the published aggregate still bundles io/agentscope/extensions/redis/** while declaring no org.redisson dependency. That packaging decision remains queued behind the maintainer decision in #3083, exactly as stated in the evaluation above.

    Effect on this window: approving here no longer means "generate the guard" — that half already has an author, a test suite and green license/validate checks (the two build jobs were still pending at the time of writing). We will not file a competing guard fix. The only automatable remainder is the aggregate dependency declaration, and it is entangled with the open #3083 decision, so nothing is generated until either #3112 lands (guard is done) or a maintainer rules on #3083 (packaging becomes actionable). Reviewers should route their attention to #3112 first.

    Automated by github-manager-bot

  4. oss-maintainer commented on Sep 14, 2026

    @oss-maintainer
    Collaborator

    Status: 72 h feedback window expired — no automated PR will be generated, this proposal window here is closed

    The fix proposal evaluated above went 72 hours without community feedback (no reply on this thread since 2026-09-11 13:08 UTC), so per our workflow we skip PR generation and the proposal window here is closed. No action is needed from anyone.

    For context, this issue is already covered by an open community PR:

    As of this check #3112 is MERGEABLE with reviewDecision=APPROVED, and every check reports success at head 7ac7282 (build (ubuntu-latest), build (windows-latest), Check License, Check Module Sync, validate, codecov/patch, license/cla), most recently updated 2026-09-13 05:59 UTC. It targets the same failure this issue reports — resolving RScript.ReturnType.LONG at construction time so a Redisson 3.x classpath fails early with an actionable message instead of the opaque NoSuchFieldError.

    #3112 stays the active path for this issue. If a maintainer would still prefer an independent proposal here, reply on the issue and we will re-evaluate.

    Automated by github-manager-bot

  5. added a commit that references this issue on Sep 21, 2026
    f5d1207
  6. mvanhorn commented on Oct 27, 2026

    @mvanhorn
    Contributor

    Quick status note for whoever triages Redis issues: #3112 (the fail-early guard for Redisson 3.x on the classpath) has been approved since Sep 21, with the review items addressed in c19b7bc. It still needs a maintainer to merge it. The packaging question in item 1 (declaring the Redisson dependency in the aggregate) is still tied to #3083 and isn't part of that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions