Skip to content
Advertisement

LazySodiumJava FileSystemNotFoundException Occured

I’m trying to use LazySodiumjava library, but I got an errors follow:

java.nio.file.FileSystemNotFoundException
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:172)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:158)
        at java.base/java.nio.file.Path.of(Path.java:208)
        at java.base/java.nio.file.Paths.get(Paths.java:98)
        at co.libly.resourceloader.ResourceLoader.getFileFromFileSystem(ResourceLoader.java:237)
        at co.libly.resourceloader.ResourceLoader.copyToTempDirectory(ResourceLoader.java:88)
        at co.libly.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:53)
        at com.goterl.lazycode.lazysodium.utils.LibraryLoader.loadBundledLibrary(LibraryLoader.java:133)
        at com.goterl.lazycode.lazysodium.utils.LibraryLoader.loadLibrary(LibraryLoader.java:94)
        at com.goterl.lazycode.lazysodium.SodiumJava.<init>(SodiumJava.java:34)
        at com.goterl.lazycode.lazysodium.SodiumJava.<init>(SodiumJava.java:23)
        at com.eugene.kuchain.chain.Identity.Issuer.generateSignature(Issuer.java:27)
        at com.eugene.kuchain.chain.Data.Transaction.<init>(Transaction.java:20)
        at com.eugene.kuchain.chain.Core.BadgeBaker.addTransaction(BadgeBaker.java:63)
        at com.eugene.kuchain.chain.Core.BadgeBaker.addBadge(BadgeBaker.java:56)
        at com.eugene.kuchain.web.WebCommunicator.issueBadge(WebCommunicator.java:445)
        at com.eugene.kuchain.web.WebCommunicator.doBake(WebCommunicator.java:254)
        at com.eugene.kuchain.web.WebCommunicator.doTask(WebCommunicator.java:90)
        at com.eugene.kuchain.web.DefaultController.doBake(DefaultController.java:52)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
        at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:348)
        at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:53)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:830)

However, it works on my computer, but when I send it to another computer, the error occured.

I use same JDK 13 ( installed with same installation file ) on both computer.

The jar is working with Tomcat however, I copied whole tomcat folder to another one, but only working on my desktop.

I set every envrionment to same about java and tomcat on both computers. Here I attatch my Java code :

public String generateSignature(String message) throws SodiumException {
    LazySodiumJava lazySodium = new LazySodiumJava(new SodiumJava());  /* the error occured */
    Sign.Lazy sign = (Sign.Lazy) lazySodium;
    byte[] key = readPrivateKey();
    byte[] pKey = readPublicKey();
    Key secretKey = Key.fromBytes(key);
    Key pubKey = Key.fromBytes(pKey);

    KeyPair keyPair = new KeyPair(pubKey, secretKey);
    String signedMessage = sign.cryptoSign(message, keyPair.getSecretKey());
}

Also I have tried :

public String generateSignature(String message) throws SodiumException {
    LazySodiumJava lazySodium = new LazySodiumJava(new SodiumJava()); /* the error occured */
    LazySodiumJava lazySodiumJava1 = lazySodium;
    byte[] key = readPrivateKey();
    byte[] pKey = readPublicKey();
    Key secretKey = Key.fromBytes(key);
    Key pubKey = Key.fromBytes(pKey);

    KeyPair keyPair = new KeyPair(pubKey, secretKey);
    String signedMessage = lazySodiumJava1.cryptoSign(message, keyPair.getSecretKey());
}

I can’t figure out what is wrong because it’s working on my desktop.

The place where error occured is : LazySodiumJava lazySodium = new LazySodiumJava(new SodiumJava());

Thanks.

Advertisement

Answer

I solve the problem. On my another computer doesn’t have libsodium library. I don’t know how my desktop download it itself however, I downloaded libsodium library from https://download.libsodium.org/libsodium/releases/, and change LazySodiumJava lazySodium = new LazySodiumJava(new SodiumJava()); into LazySodiumJava lazySodium = new LazySodiumJava("ABSOLUTE/PATH/TO/libsodium"); as the document said.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement