Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazysodium 5.1.1 doesn't load libsodium for Rocky Linux 8 #114

Open
marseg opened this issue Nov 17, 2021 · 1 comment
Open

Lazysodium 5.1.1 doesn't load libsodium for Rocky Linux 8 #114

marseg opened this issue Nov 17, 2021 · 1 comment

Comments

@marseg
Copy link

marseg commented Nov 17, 2021

Hi there,

I have an issue with starting my app that uses Lazysodium. And this issue is reproduces only on Rocky Linux OS but not other ones that I'd tried (ubuntu, macos):

at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.goterl.lazysodium.LazySodiumJava]: Factory method 'lazySodium' threw exception; nested exception is com.goterl.resourceloader.ResourceLoaderException: Failed to load the bundled library from resources by relative path (linux64/libsodium.so)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 25 common frames omitted
Caused by: com.goterl.resourceloader.ResourceLoaderException: Failed to load the bundled library from resources by relative path (linux64/libsodium.so)
at com.goterl.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:66)
at com.goterl.lazysodium.utils.LibraryLoader.loadBundledLibrary(LibraryLoader.java:134)
at com.goterl.lazysodium.utils.LibraryLoader.loadLibrary(LibraryLoader.java:95)
at com.goterl.lazysodium.SodiumJava.(SodiumJava.java:34)
at com.goterl.lazysodium.SodiumJava.(SodiumJava.java:23)
at com.pps.payop.withdrawal.PayOpWithdrawalConfiguration.lazySodium(PayOpWithdrawalConfiguration.java:53)
at com.pps.payop.withdrawal.PayOpWithdrawalConfiguration$$EnhancerBySpringCGLIB$$a7ddb078.CGLIB$lazySodium$6()
at com.pps.payop.withdrawal.PayOpWithdrawalConfiguration$$EnhancerBySpringCGLIB$$a7ddb078$$FastClassBySpringCGLIB$$f724769a.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at com.pps.payop.withdrawal.PayOpWithdrawalConfiguration$$EnhancerBySpringCGLIB$$a7ddb078.lazySodium()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 26 common frames omitted
Caused by: java.io.IOException: Failed to list contents of file:/home/pps/core/pps-4.30.0-SNAPSHOT.jar!/BOOT-INF/lib/lazysodium-java-5.1.1.jar!/linux64/libsodium.so
at com.goterl.resourceloader.ResourceLoader.doCopyDirectory(ResourceLoader.java:362)
at com.goterl.resourceloader.ResourceLoader.copyDirectory(ResourceLoader.java:354)
at com.goterl.resourceloader.ResourceLoader.getFileFromFileSystem(ResourceLoader.java:248)
at com.goterl.resourceloader.ResourceLoader.copyToTempDirectory(ResourceLoader.java:88)
at com.goterl.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:53)

Is this problem specific for this OS?
Or could you help me out somehow with this problem?

Thanks in advance,
Siarhei

@gurpreet-
Copy link
Contributor

Because Lazysodium bundles native binaries inside its resources folder, this exception is due to LazySodium failing to extract those binaries out of a nested JAR situation.

You could try to instantiate LazySodium by providing an absolute path to your own native binaries that you store somewhere. There is a constructor param to handle this.

Though I think this PR fixes the situation entirely terl/resource-loader#12

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

No branches or pull requests

2 participants