Skip to content

Commit cf6aa0e

Browse files
BarbatosBarbatos
authored andcommitted
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 passes
1 parent 22e0aa3 commit cf6aa0e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

plugins/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ dependencies {
3939
exclude group: 'io.prometheus'
4040
exclude group: 'org.aspectj'
4141
exclude group: 'org.apache.httpcomponents'
42+
// :crypto -> :common -> :platform transitively pulls leveldbjni-all 1.8,
43+
// which conflicts with the io.github.tronprotocol leveldbjni-all 1.18.2
44+
// declared below on x86. Both jars contain org/iq80/leveldb/Options.class;
45+
// in the fat jar the duplicate-entry write order can leave the 1.8 copy,
46+
// which lacks Options.maxBatchSize(int) and breaks `db archive` at runtime.
47+
exclude group: 'org.fusesource.leveldbjni', module: 'leveldbjni-all'
4248
}
4349
implementation group: 'info.picocli', name: 'picocli', version: '4.6.3'
4450
implementation group: 'com.typesafe', name: 'config', version: '1.3.2'

0 commit comments

Comments
 (0)