![](/img/trans.png)
[英]java.lang.NoClassDefFoundError: Could not initialize class org.jose4j.jwa.AlgorithmFactoryFactory JsonWebSignature getCompactSerialization
[英]java.lang.NoClassDefFoundError: Could not initialize class org.ghost4j.GhostscriptLibrary
我试图在Linux服务器上安装Ghostscript,以便可以使用Ghost4j的PDF实用程序。
我在LinuxBrew上安装了Ghostscript,并将Ghostscript二进制文件的路径添加到$ PATH。 因此,在此之后,我得到了以下错误:
java.lang.UnsatisfiedLinkError: Unable to load library 'gs': Native library (linux-x86-64/libgs.so) not found in resource path
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.<init>(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at org.ghost4j.GhostscriptLibraryLoader.loadLibrary(GhostscriptLibraryLoader.java:39)
at org.ghost4j.GhostscriptLibrary.<clinit>(GhostscriptLibrary.java:36)
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:323)
在这一步,它能够加载并执行到GhostscriptLibrary。
经过一些研究后,我在该线程之后添加了symlink ln -s path/to/Ghostscript/lib/libgs.so.9.22 /usr/lib/libgs.so
无法加载库'gs':libgs.so:无法打开共享库目标文件:没有这样的文件或目录 ,这可以解决先前的错误,但又给出了另一个错误:
java.lang.NoClassDefFoundError: Could not initialize class org.ghost4j.GhostscriptLibrary at
org.ghost4j.Ghostscript.initialize(Ghostscript.java:323)
包含类GhostscriptLibrary的jar文件(ghost4j-1.0.1.jar)在类路径中,并且在我的Mac上本地完全正常。
我正在使用Ghostscript 9.22和Ghost4j 1.0.1
任何帮助将是巨大的:)
通过卸载Ghostscript并按照此页面上的说明进行重新安装,我能够解决上述错误:http://www.linuxfromscratch.org/blfs/view/svn/pst/gs.html并将环境变量LD_LIBRARY_PATH设置为包括.so文件的路径。
这是一个无法正确加载本机库的问题,这无论如何都会导致第二个错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.