jacl2jython utility

Both Jacl and Jython scripting languages are supported in WebSphere Application Server but JACL is deprecated and you should develop all your new wsadmin scripts using Jython. If you have existing JACL scripts then you can use the jacl2jython utility shipped with WebSPhere Application Server toolkit to convert your jacl script into jython script. This utility is meant to do most of the preliminary conversions and once the syntax conversion is done, you will have to manually verify the script to resolve problems and make sure that it is converted as per your intention. Take a look at Migrating administrative script to Jython section for further information

I tried using this this conversion utility to convert Hello World jacl script to jython by following these steps

  • Create test.jacl script like this

    puts "Hello world"


  • Then go to <applicationservertoolkitroot>/bin folder and execute Jacl2Jython.bat c:\temp\test.jacl to convert my test.jacl into jython file

  • The conversion utility creates a .py file in the same directory as that of the .jacl script, in my case it created test.py file like this

    import sys
    def wsadminToList(inStr):
    outList=[]
    if (len(inStr)>0 and inStr[0]=='[' and inStr[-1]==']'):
    tmpList = inStr[1:-1].split(" ")
    else:
    tmpList = inStr.split("\n") #splits for Windows or Linux
    for item in tmpList:
    item = item.rstrip(); #removes any Windows "\r"
    if (len(item)>0):
    outList.append(item)
    return outList
    #endDef

    print "Hello world"




If you search for wsadmin script samples on google most of the examples that you will find are developed using the JACL syntax so this utility comes in handy to convert those samples into jython

2 comments:

  1. Hi Sunil,

    I am unable to avoid the stale connection WID 7 so could you please explain me how to do that one.

    Thanks in advance.

    ReplyDelete
  2. Hi Sunil,

    I am unable to avoid the stale connection WID 7 so could you please explain me how to do that one.

    ReplyDelete