IBM Support

Adding Jython modules to the classpath

Troubleshooting


Problem

A Jython script, with an import command, works only if you have the respective module in the same directory.

Symptom

In this command, wsadmin.sh -f /scirpts/jython/jvm.py, the jmv.py file contains the following line:

import common

The term "common" is nothing but a sample Jython script called common.py.

The only way to get this to work is to run the wsadmin command from the exact directory that common.py exists in. Otherwise, it fails with the following exception:

WASX7209I: Connected to process "dmgr" on node manager using SOAP connector;  The type of process is: DeploymentManager                
WASX7017E: Exception received while running file "/scripts/61/jython/jvm.py";
exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last): File "<string>", line 26, in ?
ImportError: no module named common

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Administrative Scripting Tools (for example: wsadmin or ANT)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.5.5;8.0;7.0","Edition":"Base;Network Deployment","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
03 March 2025

UID

swg21268538