Java Jython unsatisfied link error

python
Tags: #<Tag:0x00007fb87d904a10>

#1

Hello!

When I am running the following jython script (only one line):

from subprocess import Popen, PIPE

I am obtaining below error on one computer (Windows 10) but not on another computer (Mac OS). On both computers I am running a freshly updated Fiji (rc-59/1.51j) with Java 1.8.0_66. Please let me know if you need more information or want me to test it on other computers as well. Maybe some issue with my java settings?

Started New_.py at Thu Mar 09 22:04:29 CET 2017
Traceback (most recent call last):
  File "New_.py", line 1, in <module>
  File "C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\subprocess.py", line 770, in <module>
  File "C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\subprocess.py", line 1380, in Popen
  File "C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\ctypes\__init__.py", line 281, in __getattr__
  File "C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\ctypes\__init__.py", line 262, in __init__
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign.newLoadError(Foreign.java:72)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign.access$300(Foreign.java:42)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign$InValidInstanceHolder.getForeign(Foreign.java:98)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign.getInstance(Foreign.java:103)
	at org.scijava.jython.shaded.com.kenai.jffi.Library.openLibrary(Library.java:151)
	at org.scijava.jython.shaded.com.kenai.jffi.Library.getCachedInstance(Library.java:125)
	at org.python.modules.jffi.DynamicLibrary.<init>(DynamicLibrary.java:26)
	at org.python.modules.jffi.jffi.dlopen(jffi.java:44)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)

java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError

	at org.python.core.Py.JavaError(Py.java:546)
	at org.python.core.Py.JavaError(Py.java:537)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
	at org.python.core.PyObject.__call__(PyObject.java:478)
	at org.python.core.PyObject.__call__(PyObject.java:482)
	at ctypes$py.__init__$49(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\ctypes\__init__.py:262)
	at ctypes$py.call_function(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\ctypes\__init__.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
	at org.python.core.PyFunction.__call__(PyFunction.java:482)
	at org.python.core.PyFunction.__call__(PyFunction.java:476)
	at org.python.core.PyInstance.__init__(PyInstance.java:124)
	at org.python.core.PyClass.__call__(PyClass.java:193)
	at org.python.core.PyObject.__call__(PyObject.java:461)
	at org.python.core.PyObject.__call__(PyObject.java:465)
	at ctypes$py.__getattr__$54(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\ctypes\__init__.py:283)
	at ctypes$py.call_function(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\ctypes\__init__.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:153)
	at org.python.core.PyFunction.__call__(PyFunction.java:423)
	at org.python.core.PyMethod.__call__(PyMethod.java:141)
	at org.python.core.PyMethod.__call__(PyMethod.java:132)
	at org.python.core.Deriveds.__findattr_ex__(Deriveds.java:73)
	at org.python.core.PyObjectDerived.__findattr_ex__(PyObjectDerived.java:1036)
	at org.python.core.PyObject.__getattr__(PyObject.java:1006)
	at subprocess$py.Popen$20(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\subprocess.py:1867)
	at subprocess$py.call_function(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\subprocess.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
	at org.python.core.Py.makeClass(Py.java:1837)
	at org.python.core.Py.makeClass(Py.java:1831)
	at subprocess$py.f$0(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\subprocess.py:1989)
	at subprocess$py.call_function(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\subprocess.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:436)
	at org.python.core.util.importer.importer_load_module(importer.java:109)
	at org.python.modules.zipimport.zipimporter.zipimporter_load_module(zipimporter.java:163)
	at org.python.modules.zipimport.zipimporter$zipimporter_load_module_exposer.__call__(Unknown Source)
	at org.python.core.PyBuiltinMethodNarrow.__call__(PyBuiltinMethodNarrow.java:46)
	at org.python.core.imp.loadFromLoader(imp.java:587)
	at org.python.core.imp.find_module(imp.java:537)
	at org.python.core.imp.import_next(imp.java:840)
	at org.python.core.imp.import_module_level(imp.java:959)
	at org.python.core.imp.importName(imp.java:1062)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
	at org.python.core.PyObject.__call__(PyObject.java:431)
	at org.python.core.__builtin__.__import__(__builtin__.java:1232)
	at org.python.core.imp.importFromAs(imp.java:1156)
	at org.python.core.imp.importFrom(imp.java:1132)
	at org.python.pycode._pyx2.f$0(New_.py:1)
	at org.python.pycode._pyx2.call_function(New_.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1386)
	at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:75)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:177)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
	at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsatisfiedLinkError
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign.newLoadError(Foreign.java:72)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign.access$300(Foreign.java:42)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign$InValidInstanceHolder.getForeign(Foreign.java:98)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign.getInstance(Foreign.java:103)
	at org.scijava.jython.shaded.com.kenai.jffi.Library.openLibrary(Library.java:151)
	at org.scijava.jython.shaded.com.kenai.jffi.Library.getCachedInstance(Library.java:125)
	at org.python.modules.jffi.DynamicLibrary.<init>(DynamicLibrary.java:26)
	at org.python.modules.jffi.jffi.dlopen(jffi.java:44)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
	... 64 more
Caused by: java.lang.UnsatisfiedLinkError: org.scijava.jython.shaded.com.kenai.jffi.Foreign.getVersion()I
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign.getVersion(Native Method)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign$InstanceHolder.getInstanceHolder(Foreign.java:53)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign$InstanceHolder.<clinit>(Foreign.java:45)
	at org.scijava.jython.shaded.com.kenai.jffi.Foreign.getInstance(Foreign.java:103)
	at org.scijava.jython.shaded.com.kenai.jffi.Type$Builtin.lookupTypeInfo(Type.java:242)
	at org.scijava.jython.shaded.com.kenai.jffi.Type$Builtin.getTypeInfo(Type.java:237)
	at org.scijava.jython.shaded.com.kenai.jffi.Type.resolveSize(Type.java:155)
	at org.scijava.jython.shaded.com.kenai.jffi.Type.size(Type.java:138)
	at org.scijava.jython.shaded.jnr.ffi.provider.jffi.NativeRuntime$TypeDelegate.size(NativeRuntime.java:178)
	at org.scijava.jython.shaded.jnr.ffi.provider.AbstractRuntime.<init>(AbstractRuntime.java:48)
	at org.scijava.jython.shaded.jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:57)
	at org.scijava.jython.shaded.jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:41)
	at org.scijava.jython.shaded.jnr.ffi.provider.jffi.NativeRuntime$SingletonHolder.<clinit>(NativeRuntime.java:53)
	at org.scijava.jython.shaded.jnr.ffi.provider.jffi.NativeRuntime.getInstance(NativeRuntime.java:49)
	at org.scijava.jython.shaded.jnr.ffi.provider.jffi.Provider.<init>(Provider.java:29)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at java.lang.Class.newInstance(Class.java:442)
	at org.scijava.jython.shaded.jnr.ffi.provider.FFIProvider$SystemProviderSingletonHolder.getInstance(FFIProvider.java:60)
	at org.scijava.jython.shaded.jnr.ffi.provider.FFIProvider$SystemProviderSingletonHolder.<clinit>(FFIProvider.java:49)
	at org.scijava.jython.shaded.jnr.ffi.provider.FFIProvider.getSystemProvider(FFIProvider.java:35)
	at org.scijava.jython.shaded.jnr.ffi.Library.loadLibrary(Library.java:110)
	at org.scijava.jython.shaded.jnr.posix.POSIXFactory$DefaultLibCProvider$SingletonHolder.<clinit>(POSIXFactory.java:223)
	at org.scijava.jython.shaded.jnr.posix.POSIXFactory$DefaultLibCProvider.getLibC(POSIXFactory.java:227)
	at org.scijava.jython.shaded.jnr.posix.BaseNativePOSIX.<init>(BaseNativePOSIX.java:36)
	at org.scijava.jython.shaded.jnr.posix.WindowsPOSIX.<init>(WindowsPOSIX.java:121)
	at org.scijava.jython.shaded.jnr.posix.POSIXFactory.loadWindowsPOSIX(POSIXFactory.java:115)
	at org.scijava.jython.shaded.jnr.posix.POSIXFactory.loadNativePOSIX(POSIXFactory.java:84)
	at org.scijava.jython.shaded.jnr.posix.POSIXFactory.loadPOSIX(POSIXFactory.java:38)
	at org.scijava.jython.shaded.jnr.posix.LazyPOSIX.loadPOSIX(LazyPOSIX.java:35)
	at org.scijava.jython.shaded.jnr.posix.LazyPOSIX.posix(LazyPOSIX.java:31)
	at org.scijava.jython.shaded.jnr.posix.LazyPOSIX.isNative(LazyPOSIX.java:325)
	at org.python.modules.posix.PosixModule.classDictInit(PosixModule.java:122)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.python.core.PyJavaType.init(PyJavaType.java:553)
	at org.python.core.PyType.createType(PyType.java:1412)
	at org.python.core.PyType.addFromClass(PyType.java:1348)
	at org.python.core.PyType.fromClass(PyType.java:1439)
	at org.python.core.imp.createFromClass(imp.java:457)
	at org.python.core.imp.loadBuiltin(imp.java:571)
	at org.python.core.imp.find_module(imp.java:522)
	at org.python.core.imp.import_next(imp.java:840)
	at org.python.core.imp.import_module_level(imp.java:959)
	at org.python.core.imp.importName(imp.java:1062)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
	at org.python.core.PyObject.__call__(PyObject.java:431)
	at org.python.core.__builtin__.__import__(__builtin__.java:1232)
	at org.python.core.imp.importAll(imp.java:1182)
	at os$py.f$0(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\os.py:724)
	at os$py.call_function(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\os.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:436)
	at org.python.core.util.importer.importer_load_module(importer.java:109)
	at org.python.modules.zipimport.zipimporter.zipimporter_load_module(zipimporter.java:163)
	at org.python.modules.zipimport.zipimporter$zipimporter_load_module_exposer.__call__(Unknown Source)
	at org.python.core.PyBuiltinMethodNarrow.__call__(PyBuiltinMethodNarrow.java:46)
	at org.python.core.imp.loadFromLoader(imp.java:587)
	at org.python.core.imp.find_module(imp.java:537)
	at org.python.core.imp.import_next(imp.java:840)
	at org.python.core.imp.import_module_level(imp.java:959)
	at org.python.core.imp.importName(imp.java:1062)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
	at org.python.core.PyObject.__call__(PyObject.java:431)
	at org.python.core.__builtin__.__import__(__builtin__.java:1232)
	at org.python.core.imp.importOne(imp.java:1081)
	at site$py.f$0(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\site.py:637)
	at site$py.call_function(C:\Users\tischer\Desktop\Fiji\Fiji.app\jars\jython-shaded-2.7.0.jar\Lib\site.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:436)
	at org.python.core.util.importer.importer_load_module(importer.java:109)
	at org.python.modules.zipimport.zipimporter.zipimporter_load_module(zipimporter.java:163)
	at org.python.modules.zipimport.zipimporter$zipimporter_load_module_exposer.__call__(Unknown Source)
	at org.python.core.PyBuiltinMethodNarrow.__call__(PyBuiltinMethodNarrow.java:46)
	at org.python.core.imp.loadFromLoader(imp.java:587)
	at org.python.core.imp.find_module(imp.java:537)
	at org.python.core.imp.import_next(imp.java:840)
	at org.python.core.imp.import_first(imp.java:861)
	at org.python.core.imp.load(imp.java:716)
	at org.python.core.Py.importSiteIfSelected(Py.java:1558)
	at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:116)
	at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:94)
	at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:71)
	at org.scijava.plugins.scripting.jython.JythonScriptEngine.<init>(JythonScriptEngine.java:55)
	at org.scijava.plugins.scripting.jython.DefaultJythonService.getScriptEngine(DefaultJythonService.java:72)
	at org.scijava.plugins.scripting.jython.JythonScriptLanguage.getScriptEngine(JythonScriptLanguage.java:71)
	at org.scijava.script.ScriptModule.getEngine(ScriptModule.java:128)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:149)
	... 8 more

#2

I can reproduce this error with Fiji using Java 1.8.0_122 on Win7 64bit. Using Fiji on Manjaro Linux does not reproduce it.

When I look at the error messages, the problem can be traced back to to the ctypes module that does only contain the file __init__.py. There jffi is involved. I don’t know what jffi is intended to do. On GitHub there is no description for this project. But there is a bug report about jffi and the Java Foreign Function Interface. I have no time to read it, but probably it can help.

Best regards
Michael