From: Sunil <re...@bu...> - 2020-04-20 06:10:22
|
New submission from Sunil <sun...@gm...>: 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; } } ---------- components: Library messages: 13028 nosy: Sunil1993 severity: urgent status: open title: Null pointer exception PyModule.java type: behaviour versions: Jython 2.7.2 _______________________________________ Jython tracker <re...@bu...> <https://bugs.jython.org/issue2876> _______________________________________ |