Issue1611984

classification
Title: Jython not finding classes in Classpath
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, ks_srikanth
Priority: normal Keywords:

Created on 2006-12-09.04:28:01 by ks_srikanth, last changed 2007-01-03.03:01:58 by cgroves.

Messages
msg1363 (view) Author: Srikanth (ks_srikanth) Date: 2006-12-09.04:28:01
Hi,
I have created .py script and trying to execute the script from my application deployed in Weblogic9.1. I am using "Jython2.2a1" for the same. Though I have set the application jar file in the CLASSPATH, Jython finds only the package.
My script code is as simple as this: 
-----------------------------------
from com.xyz.components.impl import Class1
c1 = Class1()
c1.execute()
-----------------------------------
In the above example, Jython throws an ImportError for Class1 at line1, though it recognizes the package. 
I got some hints when I did some internet search - using PySystemState.addPackage("com.xyz.components.impl.Class1")
Now, the import error has vanished. But it throws a "NullPointerException" at line 2. 
------------------------------
The error is ...
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native method)
at org.python.core.PyJavaClass.check_lazy_allowed(PyJavaClass.java:92)
at org.python.core.PyJavaClass.initLazy(PyJavaClass.java:99)
at org.python.core.PyJavaClass.initialize(PyJavaClass.java:116)
....
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:169)
-------------------------------
Assuming this a class loader problem, I even tried to extend PythonInterpreter and set myClassLoader to PySystemState during initializing. But still it has not resolved my problem. 
Am I going in the right direction? Is there any easy fix for the problem? Can anyone help me find the correct solution for this? 
msg1364 (view) Author: Charlie Groves (cgroves) Date: 2007-01-03.03:01:58
I actually fixed a problem in setting the classloader in PySystemState after 2.2a1 was released.  It sounds like you're going in the right direction.  Could you try with the snapshot that's up in the downloads section now?
History
Date User Action Args
2006-12-09 04:28:01ks_srikanthcreate