Skip to content

Conversation

@jjohannes
Copy link

A folder with a - in its name is not considered a package by Java and is then allowed to exist in multiple Jars without causing a split-package issue. See description of #274 for a detailed explanation.

Fixes #274

@garyschulte
Copy link
Contributor

I will check the library loading in besu with these changes. TBH we have not seen any gradle packaging problems across modules, so this is news to me. I hadn't seen #274 until this morning.

@jjohannes
Copy link
Author

jjohannes commented Oct 15, 2025

There is another issue when loading on the module path. This code leads to the attempt to find a resource that is in another Module:

BesuNativeLibraryLoader.registerJNA(Library.class, "besu_native_ec_crypto");
  • Library.class is inside com.sun.jna
  • besu_native_ec_crypto is in org.hyperledger.besu.nativelib.secp256r1

The loading is later attempted via classResource.getResourceAsStream(libraryResourcePath). That does not work if class and resource are not in the same module.

I am not sure if the code is correct in general. Is it correct that the besu_native_ec_crypto implementation is bound to the generic com.sun.jna.Library?
If that is intended, registerJNA should probably take two Class arguments:

  1. The interface to bind the implementation to
  2. A class/interface as a reference to the module the ressource is loaded from via Class.getResourceAsStream

A folder with a '-' is not considered a package by Java and is then
allowed to exist in multiple Jars without causing a split-package
issue.

Signed-off-by: Jendrik Johannes <[email protected]>
@ryjones ryjones force-pushed the 274-split-package-fix branch from 12492c9 to c6f6b3a Compare October 31, 2025 13:49
@stoyanov-st
Copy link

Hello besu-native team!
Could we have an ETA for when this PR could be reviewed/merged and at what version would it be included?
This fix is crucial for us and will unblock us to deliver Pectra features for our clients!
Thanks for looking into it 🙏

@Ferparishuertas
Copy link

@lu-pinto @macfarla @garyschulte anyways we can bump this PR, and give it priority?

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.

Split package issue when using multiple besu-native Jars with the Java Module System

4 participants