#***** Main.py *********
print AdminApp.list()
import test
test.show()
#*************************
#***** test.py ***********
def show():
print AdminApp.list()
#**************************
When I execute the Main.py:
./wsadmin.sh -lang jython -f Main.py
The AdminApp.list() in Main.py displays a list of applications,
however I get "NameError: AdminApp" when test.show() is executed. Both
files try to do the same thing, however, the imported test.py fails
when trying to access the "AdminApp" management object. The only way I
have been able to get it to work is to pass the management objects as
parameters. There has to be a better way of doing this. Does anyone
know how to make the WebSphere management objects visible to imported
jython modules? When using JACL I don't experience this same
limitation.
com.ibm.ws.scripting.host=localhost
com.ibm.ws.scripting.defaultLang=jython
com.ibm.ws.scripting.echoparams=true
com.ibm.ws.scripting.traceFile=/tmp/jythonScript.trace
com.ibm.ws.scripting.validationOutput=/tmp/jythonValidation
com.ibm.ws.scripting.profiles=<yourWASHome>/bin/securityProcs.jacl;<yourWASHome>/bin/LTPA_LDAPSecurityProcs.jacl;~/Main.py;~/test.py
Then, if you call wsadmin with that properties file, such as: -
wsadmin.sh -p ~/wsadminjy.properties
And you should got those two files loaded automatically.
Either that or you could set up a command alias that calls something like
wsadmin.sh -profile ~all.py
And have all the functions defined within that all.py file.
Peter Bennett
Distributed Systems Professional Services Ltd.
"Rommer" <phill0...@netscape.net> wrote in message
news:1184100124.1...@i38g2000prf.googlegroups.com...