差異處
這裏顯示兩個版本的差異處。
java:jna:can_t_obtain_static_method的error [2017/07/11 14:37] tony |
java:jna:can_t_obtain_static_method的error [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>Java JNA}} | ||
- | ====== Can't obtain static method的Error ====== | ||
- | ===== Problem ===== | ||
- | 有天某個客戶說我們的軟體服務無法啟動,傳回來的debug log中,包含以下錯誤: | ||
- | <code> | ||
- | java.lang.UnsatisfiedLinkError: Can't obtain static method fromNative(Method, Object) from class com.sun.jna.Native | ||
- | </code> | ||
- | |||
- | ===== How to duplicate and resolve? ===== | ||
- | 首先這個問題是由於JNA版本不同造成的。我們使用4.1.0版本的JNA,com.sun.jna.Native中並沒有fromNative(Method, Object),確認過JNA GitHub後,這應是4.3.0後加入的method。\\ | ||
- | 因此,面對此問題,我懷疑可能是: | ||
- | * 我們軟體的third-party libraries包含新版本JNA。 | ||
- | * 我們軟體參考到客戶電腦中的JNA。 | ||
- | 第一個問題我透過[[http://alumnus.caltech.edu/~leif/opensource/cpcheck/CpCheckApp.html|Classpath Inspector]]確認過,並非我們問題。第二個問題,首先我透過設定CLASSPATH到環境變數中,並指定到4.3.0的jar檔路徑;可惜無法重現出問題。 | ||
- | ===== Reference ===== | ||
- | * [[https://github.com/java-native-access/jna/blob/4.1.0/src/com/sun/jna/Native.java|JNA 4.1.0 source code]] | ||
- | * [[https://github.com/java-native-access/jna/blob/4.3.0/src/com/sun/jna/Native.java|JNA 4.3.0 source code]] | ||
- | * [[https://github.com/java-native-access/jna/issues/384|jna.nosys=true should be default]] | ||
- | * [[https://github.com/java-native-access/jna/issues/750|JNA 4.2.2 not working on android-arm]] | ||
- | * [[https://github.com/defold/editor2-issues/issues/1019|其它軟體類似問題]] | ||
- | |||
- | ===== ===== | ||
- | ---- | ||
- | \\ | ||
- | ~~DISQUS~~ | ||