This method uses a simple boot script to launch a read-execute-print-loop (REPL) which you use for your own work. wsadmin does not set up the modules it's imported properly. This you need to fix in your top-level script. Here's the invocation:
${path-to-wsadmin}/wsadmin.sh -lang jython -f ./repl.pyHere's repl.py
import sys
sys.modules['AdminConfig'] = AdminConfig
import code
repl = code.InteractiveConsole()
repl.interact("jython %s console" % (sys.version))
When you run this, you get a prompt:
Your scripts need to import the relevant Admin module. e.g. 'foo.py' starts with
jython 2.1 console
>>>
So when you the script with execfile, it picks up the wsadmin modules:
import AdminConfig
class Foo:
...
or
>>> execfile('foo.py')
Now you can edit and run 'foo.py' without relaunching wsadmin.
>>> import foo
>>> reload foo
2 comments:
Hi!
Nice post, seems to be very usefull.
Unfortunately, I couldn't exit that Jython prompt using quit, quit(), exit nor exit(). Please, how do you do this?
Thanks!
import java.lang.Runtime
java.lang.Runtime.getRuntime().exit(0)
Post a Comment