Skip to content

ZOOKEEPER-4835: Make use of Netty optional when no SSL is used#2374

Open
dsmiley wants to merge 2 commits intoapache:masterfrom
dsmiley:master
Open

ZOOKEEPER-4835: Make use of Netty optional when no SSL is used#2374
dsmiley wants to merge 2 commits intoapache:masterfrom
dsmiley:master

Conversation

@dsmiley
Copy link
Copy Markdown

@dsmiley dsmiley commented Apr 20, 2026

https://issues.apache.org/jira/browse/ZOOKEEPER-4835

ZOOKEEPER-4835: Make Netty an optional dependency when SSL is not used

Netty is now declared as <optional>true</optional> in zookeeper-server/pom.xml,
so embedders who do not need SSL/TLS no longer pull in Netty transitively.
The zookeeper-assembly distribution still includes Netty for full SSL support.

Key changes:

  • Split ClientX509Util into a Netty-free base class and ClientNettyX509Util subclass,
    so the common X509/SSL abstraction compiles without Netty on the classpath.
  • Removed hard Netty references from ZooKeeper, ZooKeeperServer, and startup classes;
    Netty factory/util classes are now loaded reflectively or guarded by classpath checks.
  • Added an ArchUnit test (NettyOptionalArchTest) to enforce that core classes never
    acquire a hard compile-time dependency on Netty.

I tested that Solr's tests pass when changing it to use a local snapshot of ZK with these changes. Solr's tests embed ZK server, and also are a client to ZK.

… used (#1)

* ZOOKEEPER-4835: Make Netty optional when no SSL is used

Agent-Logs-Url: https://github.com/dsmiley/zookeeper/sessions/f61cc9b9-0ac8-4f8f-a366-2a7752cdbedc

Co-authored-by: dsmiley <377295+dsmiley@users.noreply.github.com>

* Address code review: improve error messages and add constants for magic numbers

Agent-Logs-Url: https://github.com/dsmiley/zookeeper/sessions/f61cc9b9-0ac8-4f8f-a366-2a7752cdbedc

Co-authored-by: dsmiley <377295+dsmiley@users.noreply.github.com>

* Remove non-essential log lines; add ArchUnit test to enforce Netty is optional

Agent-Logs-Url: https://github.com/dsmiley/zookeeper/sessions/34abe384-a396-4ef6-9ba0-006a7318faa8

Co-authored-by: dsmiley <377295+dsmiley@users.noreply.github.com>

* Refine ArchUnit test using dsmiley's approach; fix remaining Netty hard-refs in ZooKeeper/ZooKeeperServer

Agent-Logs-Url: https://github.com/dsmiley/zookeeper/sessions/698a4b0f-1e5b-46f8-bf10-f21f9a65a382

Co-authored-by: dsmiley <377295+dsmiley@users.noreply.github.com>

* Fix NoClassDefFoundError: split ClientX509Util into Netty-free base and ClientNettyX509Util subclass

Agent-Logs-Url: https://github.com/dsmiley/zookeeper/sessions/2dc4e1b6-53f1-4851-91ed-b4427d332564

Co-authored-by: dsmiley <377295+dsmiley@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: dsmiley <377295+dsmiley@users.noreply.github.com>
Copy link
Copy Markdown
Author

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All code changes were done by GitHub Copilot Agent, and me going through 3-4 rounds of prompts... plus me showing the ArchUnit test I wrote a few years ago.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the code here moved from ClientX509Util

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

Successfully merging this pull request may close these issues.

2 participants