我有一個Java小程序,它允許我訪問遠程服務器中的本地存儲。它在Windows下工作正常(IE 7.0.5730.13,Java SE 1.6.0.05)。根據Java控制檯它下載的Java本地接口的本地庫:使用OpenJDK的1.8發現本機庫時發生Java UnsatisfiedLinkError
在Linux下:
ClientInterface::downloadLib: downloaded C:\Documents and Settings\user\IBM\10.10.10.65\remotedrive3d.dll in 1 attempts.
Initializing RemoteDisk v2.2
..和我能夠訪問本地存儲設備。 0_121和IcedTea項目的Web 1.6.2它還會下載本機庫:
ClientInterface::downloadLib: downloaded /root/IBM/10.10.10.65/libibmxrdisk.so.1.0.3 in 1 attempts.
然而,它未能與UnsatisfiedLinkError
錯誤消息運行:
Initializing RemoteDisk v2.2
OpenJDK 64-Bit Server VM warning: You have loaded library /root/IBM/10.10.10.65/libibmxrdisk.so.1.0.3 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'.
java.lang.UnsatisfiedLinkError: VirtualDrive.PassThroughCommand.GetSupportedDevices()LVirtualDrive/SupportedDevices;
at VirtualDrive.PassThroughCommand.GetSupportedDevices(Native Method)
at com.ibm.asm.remotedisk.RemoteDisk.buildDriveList(Unknown Source)
at com.ibm.asm.remotedisk.RemoteDisk.start(Unknown Source)
at sun.applet.AppletPanel.run(AppletPanel.java:476)
at sun.applet.AppletViewerPanelAccess.run(AppletViewerPanelAccess.java:84)
at java.lang.Thread.run(Thread.java:745)
..和我不能夠訪問本地存儲設備:當我開始火狐
使用strace -f
,那麼我可以清楚地看到libibmxrdisk.so.1.0.3
文件被訪問。例如:
[pid 6741] open("/root/IBM/10.10.10.65/libibmxrdisk.so.1.0.3", O_RDONLY|O_NONBLOCK) = 48
[pid 6741] read(48, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\334S\0\0004\0\0\0"..., 52) = 52
[pid 6741] close(48)
這/root/IBM/10.10.10.65/libibmxrdisk.so.1.0.3
似乎包含字符串像GetSupportedDevices
:
[email protected]:~/IBM/10.10.10.65# strings libibmxrdisk.so.1.0.3 | grep -i GetSupportedDevices
Java_VirtualDrive_PassThroughCommand_GetSupportedDevices
GetSupportedDevices
Java_VirtualDrive_PassThroughCommand_GetSupportedDevices
[email protected]:~/IBM/10.10.10.65#
是Linux操作系統專用機庫libibmxrdisk.so.1.0.3
可能壞了?它可能與OpenJDK不兼容?如何進一步調試?
是什麼'文件libibmxrdisk.so.1.0.3'說? – omajid
獲取'libibmxrdisk.so.1.0.3'的副本並運行'ldd'來查看它依賴的其他庫。 – alvits
這可能是因爲你的應用程序已經加載了庫,並且應用程序試圖再次加載它,那麼JVM將拋出'UnsatisfiedLinkError'參見https://examples.javacodegeeks.com/java-basics/exceptions/java-lang-unsatisfiedlinkerror-how-to-handle-unsatisfied-link-error/ –