Using Jython 2.2.1 with WSAdmin Tool

Posted on 02/05/2009 , 3 Comments ( Add )

In one of the previous posts I complained that wsadmin tool (which is the main WebSphere Application Server administration tool) still relies on Jython 2.1, which is quite old.

The issue became critical when I realized that jython automatically re-compiles classes compiled with a different jython version. In my case, I was using Jython 2.2 for my Ant scripts and Jython 2.1 for wsadmin scripts. Some of the code was shared. This led to the situation of concurrent builds stepping on each other by dynamically re-compiling classes with different jython versions. The error looked something like that:


File "<string>", line 5, in ?
java.lang.ArrayIndexOutOfBoundsException: -4
at org.python.core.imp.createFromPyClass(Unknown Source)

Bugs like that are always fun to troubleshoot.

Going back to 2.1 was not an option for me since I use closures and “new classes” in quite a few places. So I tried putting jython 2.2.1 on wsadmin classpath and it worked without a hitch with thin wsadmin client. All my of wsadmin scripts work without a problem.

Here is a sample wsadmin.bat file that I use. This file utilizes thin client jars. Note how in line 85 my jython.jar (which is jython 2.2.1) is added to the classpath so it would override jython packages supplied with WAS.

One possible downside of this approach is running into issues with IBM support in case if you need to open a PMR related to wsadmin scripting.

3 Responses to “Using Jython 2.2.1 with WSAdmin Tool”

#35152 | February 17th, 2010 | BobGibson

When you say “So I tried putting jython 2.2.1 on wsadmin classpath and it worked without a hitch …”, what exactly do you mean?

I tried:
– specifying “-wsadmin_classpath C:\jython2.2.1\lib” on the wsadmin commandline
– modifying a copy of wsadmin.bat and prepending C:\jython2.2.1\lib on the “CLASSPATH=” assignment.
– changing the CLASSPATH environment variable

Thanks
Bob

#35153 | February 17th, 2010 | Alexander Ananiev

Bob, I use my own shell script (and an Ant task) that relies on wsadmin thin client jars (http://myarch.com/wsadmin-thin-client). In the shell script I simply add jython.jar to the classpath before all the other jars. I also set -Dpython.path there. Works like a charm.

#35154 | February 18th, 2010 | BobGibson

Can you share you shell srcript?