From: rohit s. <ro2...@ya...> - 2001-11-24 12:49:45
|
I am getting "java.lang.ExceptionInInitializationError: java.lang.NullPointerException at org.Python.core.PySystemState.<init>(PySystemState.java:158) at org.Python.util.PythonInterpreter.<init>(PythonInterpreter.java:67) at org.Python.util.PythonInterpreter.<init>(PythonInterpreter.java:45) at PyFactory.initialize(PyFactory.java 9) at A.run(A.java 9) The classes I am using are as follows(I have included only the required portion of the code):- CLASS A:- import java.util.*; public class A extends Thread{ public A(){ } public void run(){ try{ synchronized(this){ PyFactory.initialize(); PyFactory.getInterp().execfile("Python1.py"); PyFactory.getInterp().execfile("Python2.ghs"); } }catch(Exception e){ System.out.println("Exception1"+e); e.printStackTrace(); } } } CLASS B:- import java.util.*; public class B{ public static void main(String args[]){ A1 a1=new A1(); A1 a2=new A1(); a1.start(); a2.start(); } } PyFactory.java:- public class PyFactory{ private static PythonInterpreter pyInterp; public static void initialize() throws ClassNotFoundException{ pyInterp=new PythonInterpreter(); } public static PythonInterpreter getInterp(){ return pyInterp; } } Python1.py:- class ExecPython1: def __init__(self,b): self.test(b) def test(self,b): a="This is a test" print a print b Python2.ghs:- ExecPython1(1) Pl explain the cause of the error. When I am creating and running only one thread then it works fine. But with more than one threads, it gives this exception. Pl help!!!! I am sinking!!! Thanx in Advance! Rohit __________________________________________________ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 |