專案中,需要用到C庫,通過JNI進行呼叫,C庫打包檔案名稱為:libecgqrs.dll、libecgqrs.so.
我在本地windows系統下測驗過了,java加載.dll和.so檔案都是沒有問題。
本地加載方式為: System.load("D:/libecgqrs.dll"); 或者 System.load("D:/libecgqrs.so"); 這兩種都測過,沒有問題的。
阿里云ECS中加載方式為: System.load("/home/ecglibfile/libecgqrs.so"); 或者System.load("/home/ecglibfile/libecgqrs.dll"); 加載方式一樣,只是絕對路徑不同,這兩種都加載失敗,報錯資訊如下:
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /home/ecglibfile/libecgqrs.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.UnsatisfiedLinkError: /home/ecglibfile/libecgqrs.so: /home/ecglibfile/libecgqrs.so: invalid ELF header (Possible cause: endianness mismatch)
Caused by: java.lang.UnsatisfiedLinkError: /home/ecglibfile/libecgqrs.so: /home/ecglibfile/libecgqrs.so: invalid ELF header (Possible cause: endianness mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
做過這方面的兄弟們,知道這是為什么不? 在線求解~~~~
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/255750.html
標籤:應用程序開發區
上一篇:hadoop運行job報錯
