Message10324
Ran:
$ java -cp jython-2.7.0.jar org.python.util.jython -vv <<< "import os; os.getpid()"
Relevant message:
import: trying org.python.modules.posix.PosixModule as builtin modules in SysPathJavaLoader
import: 'posix' as org.python.modules.posix.PosixModule in builtin modules
Failed to load native POSIX impl; falling back on Java impl. Stacktrace follows.
java.lang.NoClassDefFoundError: Could not initialize class jnr.posix.POSIXFactory$DefaultLibCProvider$SingletonHolder
Looking at the jar that doesn't work:
$ unzip -l jython-2.7.0.jar | grep POSIXFactory
1022 2014-12-12 09:23 jnr/posix/POSIXFactory$1.class
894 2014-12-12 09:23 jnr/posix/POSIXFactory$DefaultLibCProvider$SingletonHolder.class
774 2014-12-12 09:23 jnr/posix/POSIXFactory$DefaultLibCProvider.class
6341 2014-12-12 09:23 jnr/posix/POSIXFactory.class
And the last one that did:
$ unzip -l jython-2.7.0b3.jar | grep POSIXFactory
807 2012-12-02 22:32 jnr/posix/POSIXFactory$1.class
862 2012-12-02 22:32 jnr/posix/POSIXFactory$DefaultLibCProvider$SingletonHolder.class
833 2012-12-02 22:32 jnr/posix/POSIXFactory$DefaultLibCProvider.class
863 2012-12-02 22:32 jnr/posix/POSIXFactory$LinuxLibCProvider$SingletonHolder.class
825 2012-12-02 22:32 jnr/posix/POSIXFactory$LinuxLibCProvider.class
869 2012-12-02 22:32 jnr/posix/POSIXFactory$SolarisLibCProvider$SingletonHolder.class
833 2012-12-02 22:32 jnr/posix/POSIXFactory$SolarisLibCProvider.class
887 2012-12-02 22:32 jnr/posix/POSIXFactory$WindowsLibCProvider$SingletonHolder.class
1522 2012-12-02 22:32 jnr/posix/POSIXFactory$WindowsLibCProvider.class
3660 2012-12-02 22:32 jnr/posix/POSIXFactory.class
Pushing those classes into the new jar allows jython to load the native posix implementation again:
$ cp jython-2.7.0.jar jython-2.7.0-berg.jar
$ mkdir jython-2.7.0b3
$ cd jython-2.7.0b3
$ unzip ../jython-2.7.0b3.jar
$ jar uf ../jython-2.7.0-berg.jar jnr/posix/*
$ cd ..
$ java -cp jython-2.7.0-berg.jar org.python.util.jython <<< "import os; os.getpid()"
15152
Interestingly, this happens with Java 8 (both OpenJDK and Oracle) but not with an old Java 7 install on the box.
$ java -version
openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-build_2015_03_04_15_08-b00)
OpenJDK 64-Bit Server VM (build 25.40-b25, mixed mode)
$ java -cp jython-2.7.0.jar org.python.util.jython <<< "import os; os.getpid()"
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.8.0-internal
Type "help", "copyright", "credits" or "license" for more information.
>>> import os; os.getpid()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getpid'
$ /usr/bin/java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.14.04.1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
$ /usr/bin/java -cp jython-2.7.0.jar org.python.util.jython <<< "import os; os.getpid()"
16639 |
|
Date |
User |
Action |
Args |
2015-10-07 20:59:39 | mberg | set | messageid: <1444251579.52.0.543434672703.issue2405@psf.upfronthosting.co.za> |
2015-10-07 20:59:39 | mberg | set | recipients:
+ mberg, zyasoft, mishikal@yahoo.com, darjus |
2015-10-07 20:59:39 | mberg | link | issue2405 messages |
2015-10-07 20:59:38 | mberg | create | |
|