Commit cf6aa0e
fix(plugins): exclude transitive leveldbjni-all from :crypto
Toolkit.jar built on x86_64 throws NoSuchMethodError on
org.iq80.leveldb.Options.maxBatchSize(I) at runtime when running
`db archive` / `--rebuild-manifest`.
Root cause: the :crypto module added in PR tronprotocol#6637 brings in
:common -> :platform transitively, which pulls in
org.fusesource.leveldbjni:leveldbjni-all:1.8. The direct :platform
dependency on x86 already excludes leveldbjni-all (so the
io.github.tronprotocol fork at 1.18.2 can be used instead), but the
transitive path through :crypto does not. Both jars contain
org/iq80/leveldb/Options.class; in the fat jar the duplicate-entry
write order leaves the 1.8 copy, which lacks Options.maxBatchSize(int).
Why tests didn't catch it:
- :plugins:test classpath has both jars side-by-side; the JVM
classloader returns the first match, which is 1.18.2 (declared
directly), so tests pass.
- The fat jar binaryRelease task uses zipTree to merge classes;
duplicate entries are overwritten by later writes, so the surviving
Options.class can be the 1.8 copy. Same classpath, opposite winner.
- ARM64 path declares only :platform directly (no 1.18.2), so there is
no conflict; Archive tests are also excluded on ARM64.
Fix: exclude org.fusesource.leveldbjni:leveldbjni-all from the :crypto
implementation, mirroring the existing exclusion on the direct
:platform dependency. After this change the x86 runtimeClasspath
contains only io.github.tronprotocol:leveldbjni-all:1.18.2, and the
fat jar's Options.class always exposes maxBatchSize(int).
Verified on x86_64 + JDK 8 (eclipse-temurin:8-jdk container):
- :plugins:dependencies no longer lists leveldbjni-all 1.8
- java -jar Toolkit.jar db archive -d <empty> exits 0 with the
expected "directory does not contain any database" message
- :plugins:test passes1 parent 22e0aa3 commit cf6aa0e
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
| |||
0 commit comments