Given the class
public class MyObject {
public MyObject() {
System.out.println("true = " + true);
}
}
and the jython script
import sys
sys.path.append('my-custom.jar')
from my.custom import *
config = MyObject()
I get the following error when running in WAS ND 6 wsadmin.bat
Running c:\user\jem\projects\gmm/build/deploy/x.py WASX7209I: Connected to process "dmgr" on node dmgr_node using SOAP connector; The type of process is: DeploymentManager WASX7017E: Exception received while running file "c:\user\jem\projects\gmm/build/deploy/x.py"; exception information:
com.ibm.bsf.BSFException: exception from Jython: Traceback (innermost last): File "", line 7, in ? java.lang.NullPointerException at java.lang.Class.isAssignableFrom(Native Method) at org.python.core.PyJavaClass.init_class_(PyJavaClass.java) ... about 20 lines clipped ... at org.eclipse.core.launcher.Main.run(Main.java:981) at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:339) at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:94)
java.lang.NullPointerException: java.lang.NullPointerException
Do what now?
UPDATE:
It seems that the whilst inclusion of the jar into sys.path
was enough to allow the class to be found, it was not sufficient to allow it to be instantiated. If I unzipped the jar into the existing path it worked.
So my new question is, why didn't adding the jar to sys.path
work? Is it because the jython version is too old? I believe it is v2.1.