Issue2339
Created on 2015-04-24.14:49:29 by eaaltonen, last changed 2015-04-27.10:14:01 by eaaltonen.
File name |
Uploaded |
Description |
Edit |
Remove |
JSR223.java
|
eaaltonen,
2015-04-27.07:55:37
|
Test program |
|
|
msg9954 (view) |
Author: (eaaltonen) |
Date: 2015-04-24.14:49:29 |
|
Following the wiki instructions at https://wiki.python.org/jython/UserGuide#using-jsr-223
After fixing Eclipse setting @issue2222, I get a NullPointerException. Jython is included as a Maven dependency, but is apparently not found.
|
msg9979 (view) |
Author: (eaaltonen) |
Date: 2015-04-27.07:55:37 |
|
This seems to be some sort of classloading issue that occurs both when running the sample program in the Eclipse IDE and with "mvn exec:java..."
Running (in Linux) with jython.jar in the boot classpath works without problems.
Manually registering the PyScriptEngineFactory to the ScriptEngineManager will make PyScriptEngineFactory.getScriptEngine() fail with a ClassNotFoundException.
Calling getScriptEngine() manually before calling scriptEngineManager.getEngineByName("python") will make the classloaders happy again, but the next failure is
Exception in thread "main" ImportError: Cannot import site module and its dependencies: No module named site
|
msg9980 (view) |
Author: (eaaltonen) |
Date: 2015-04-27.10:14:00 |
|
Looking at the sys.path solved this issue
sys.path: ['C:\\Users\\myuser\\.m2\\repository\\org\\python\\jython\\2.7-rc3\\Lib', '__classpath__', '__pyclasspath__/']
the 'jython' artifact was trying to import packages from a non-existent directory.
Changing the dependency to 'jython-standalone' fixed all issues.
So this is probably something that should just be more visibly documented.
|
|
Date |
User |
Action |
Args |
2015-04-27 10:14:01 | eaaltonen | set | messages:
+ msg9980 components:
+ Documentation |
2015-04-27 07:55:38 | eaaltonen | set | files:
+ JSR223.java messages:
+ msg9979 |
2015-04-24 14:49:29 | eaaltonen | create | |
|