Jython

Issue2876

classification
Title: NullPointer exception PyModule.java
Type: behaviour Severity: urgent
Components: Library Versions: Jython 2.7.2
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Sunil1993
Priority: Keywords:

Created on 2020年04月20日.06:09:56 by Sunil1993, last changed 2020年04月20日.06:11:09 by Sunil1993.

Messages
msg13028 (view) Author: Sunil (Sunil1993) Date: 2020年04月20日.06:09:56
I am trying to integrate jython in my spring boot project. It is working for me in with Intellij but when I deploy jar for testing I keep getting null pointer exception from the library.
I am using java 8.
Exception:
java.lang.NullPointerException: null
at org.python.core.PyModule.module___init__(PyModule.java:64) ~[jython-standalone-2.7.2.jar!\/:2.7.2]
at org.python.core.PyModule.<init>(PyModule.java:47) ~[jython-standalone-2.7.2.jar!\/:2.7.2]
at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:104) ~[jython-standalone-2.7.2.jar!\/:2.7.2]
at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:93) ~[jython-standalone-2.7.2.jar!\/:2.7.2]
at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:70)
JythonFactoryFile:
public class JythonObjectFactory {
 private static JythonObjectFactory instance = null;
 private static PyObject pyObject = null;
 protected JythonObjectFactory() {
 }
 public static JythonObjectFactory getInstance(){
 if(instance == null){
 instance = new JythonObjectFactory();
 }
 return instance;
 }
 public Object createObject(Object interfaceType, String moduleName){
 Object javaInt = null;
 PythonInterpreter interpreter = new PythonInterpreter();
 interpreter.exec("from " + moduleName + " import " + moduleName);
 pyObject = interpreter.get(moduleName);
 try {
 PyObject newObj = pyObject.__call__();
 javaInt = newObj.__tojava__(Class.forName(interfaceType.toString().substring(
 interfaceType.toString().indexOf(" ")+1, interfaceType.toString().length())));
 } catch (ClassNotFoundException ex) {
 log.error(JythonObjectFactory.class.getName() + " error: " + ex.getMessage(), ex);
 }
 return javaInt;
 }
}
History
Date User Action Args
2020年04月20日 06:11:09Sunil1993settitle: Null pointer exception PyModule.java -> NullPointer exception PyModule.java
2020年04月20日 06:09:56Sunil1993create

Supported by Python Software Foundation,
Powered by Roundup

AltStyle によって変換されたページ (->オリジナル) /