Title: NullPointer exception
Type: behaviour Severity: urgent
Components: Library Versions: Jython 2.7.2
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.

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.

java.lang.NullPointerException: null
at org.python.core.PyModule.module___init__( ~[jython-standalone-2.7.2.jar!\/:2.7.2]
at org.python.core.PyModule.<init>( ~[jython-standalone-2.7.2.jar!\/:2.7.2]
at org.python.util.PythonInterpreter.<init>( ~[jython-standalone-2.7.2.jar!\/:2.7.2]
at org.python.util.PythonInterpreter.<init>( ~[jython-standalone-2.7.2.jar!\/:2.7.2]
at org.python.util.PythonInterpreter.<init>(

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;
Date User Action Args
2020-04-20 06:11:09Sunil1993settitle: Null pointer exception -> NullPointer exception
2020-04-20 06:09:56Sunil1993create