Topic
  • 4 replies
  • Latest Post - ‏2013-04-19T18:05:17Z by Shaun_McEnhimer
Shaun_McEnhimer
Shaun_McEnhimer
3 Posts

Pinned topic Jacl Script Issues when trying to Set Shared Library Classpath

‏2013-04-18T20:39:09Z |

Hi Forum,

I hope this is an easy one for you all.  I am new to Jacl and Websphere scripting.  I am trying to create deployment and server modification scripts to make deployment and modification easier for my team.  I have run into an issue with a few things.  I am attempting to use a combination of ANT Tasks, and .jacl scripts.  So here goes:

 

I have attached the Jacl script.  Basically, the error I am getting is that when it executes the script, the variables are not being redered correctly between the { }.  For example, when i call the command: set result [$AdminConfig resetAttributes $lib {{classPath $classpath}}], my classpath becomes "$classpath" which i obviously do not want.  Or when I execute this command: set result "[$AdminConfig create Library $cell {{name $sharedLibName} {classPath $classpath}}]", I get an "InvalidAttributeValException: ADMG0012E: The attribute value for attribute $sharedLibName is not valid".  In my script, I print out all of the arguments before i execute the commands to ensure that they have been passed correctly and they seem fine.  Below is the ANT task that i run to execute the script.  Again, all variables are passed through to the script successfully, it just appears that when they are trying to be used between the { }, they do not render.  Has anybody experienced this before?  If i run the command within the ANT script itself, i have no issues but the reason I can't just use the ANT script is because i need to know if the Shared Library already exists.  Any help would be much appreciated and please let me know if you need anymore information.

ANT Script to run using direct commands:

<var name="setSharedLibrary" value="[$AdminConfig getid /Cell:${cell}/Library:${application_SharedLibs}]" />
<var name="resetSharedLibClasspath" value='$AdminConfig resetAttributes ${setSharedLibrary} {{classPath \"${the.sharedLib.classpath}\"}}' />


<wasadmin


wasHome="${was_home}"
command="${resetSharedLibClasspath}"
conntype="${conntype}"
host="${host}" port="${port}"
user="${user}" password="${password}"
/>

 

ANT Script to run the .jacl script file:
<wsadmin

wasHome="${was_home}"
script="C:/Users/*******/Desktop/update.jacl"
conntype="${conntype}"
host="${host}" port="${port}"
user="${user}" password="${password}" >
 
<arg value="${cellName}" />
<arg value="${application_SharedLibs2}" />
<arg value="${the.sharedLib.classpath}" />
</wasadmin>

 

Attachments

  • bpaskin
    bpaskin
    4059 Posts
    ACCEPTED ANSWER

    Re: Jacl Script Issues when trying to Set Shared Library Classpath

    ‏2013-04-19T12:42:03Z  

    Hi, variables do not get resolved within curly brackets in TCL/JACL.  JACL in WAS is deprecated.  Using Python/Jython is much more flexible.  Here is a jython script (attached).

    BTW... you do not need the Cell name since there is only 1 Cell per DMGR.

    Regards, Brian

     

    Attachments

  • bpaskin
    bpaskin
    4059 Posts
    ACCEPTED ANSWER

    Re: Jacl Script Issues when trying to Set Shared Library Classpath

    ‏2013-04-19T16:54:21Z  

    Thanks for the speedy reply.  However I have run into a new issue.  My classpath itself is set up within the ANT script as a property to look like what is is below.  It is the reformated within the ant script to append a line separator at the end of every line just like it would be done in the WAS Console.  However, when i pass this property as an argument to my script, i get the following error: "SyntaxError: Lexical error at line 1, column 59.  Encountered: "\r" (13), after : "" ".. Any Ideas?

     

    <property name="general.classpath" value="
    ${LIB_EXT_LOC}/lib/aopalliance-1.0.jar
    ${LIB_EXT_LOC}/lib/spring-web-3.0.7.RELEASE.jar
    ${LIB_EXT_LOC}/lib/commons-logging-1.1.1.jar
    ${LIB_EXT_LOC}/lib/cxf-2.6.3.jar
    " />

     

    <propertyregex property="the.sharedLib.classpath"
    input="${general.classpath}"
    regexp="   " replace="${line.separator}" global="true" />

     

     

    <wsadmin

    wasHome="${was_home}"
    script="C:/Users/*******/Desktop/addSharedLib.py"
    conntype="${conntype}"
    host="${host}" port="${port}"
    user="${user}" password="${password}" >
     
    <arg value="${cellName}" />
    <arg value="${application_SharedLibs}" />
    <arg value="${the.sharedLib.classpath}" />
    </wasadmin>

    Hi, use a semicolon as a separator not a line return.  

    /tmp/my/path/jar1.jar;/tmp/jar2.jar

    Regards,

    Brian

  • bpaskin
    bpaskin
    4059 Posts

    Re: Jacl Script Issues when trying to Set Shared Library Classpath

    ‏2013-04-19T12:42:03Z  

    Hi, variables do not get resolved within curly brackets in TCL/JACL.  JACL in WAS is deprecated.  Using Python/Jython is much more flexible.  Here is a jython script (attached).

    BTW... you do not need the Cell name since there is only 1 Cell per DMGR.

    Regards, Brian

     

    Attachments

  • Shaun_McEnhimer
    Shaun_McEnhimer
    3 Posts

    Re: Jacl Script Issues when trying to Set Shared Library Classpath

    ‏2013-04-19T16:11:02Z  
    • bpaskin
    • ‏2013-04-19T12:42:03Z

    Hi, variables do not get resolved within curly brackets in TCL/JACL.  JACL in WAS is deprecated.  Using Python/Jython is much more flexible.  Here is a jython script (attached).

    BTW... you do not need the Cell name since there is only 1 Cell per DMGR.

    Regards, Brian

     

    Thanks for the speedy reply.  However I have run into a new issue.  My classpath itself is set up within the ANT script as a property to look like what is is below.  It is the reformated within the ant script to append a line separator at the end of every line just like it would be done in the WAS Console.  However, when i pass this property as an argument to my script, i get the following error: "SyntaxError: Lexical error at line 1, column 59.  Encountered: "\r" (13), after : "" ".. Any Ideas?

     

    <property name="general.classpath" value="
    ${LIB_EXT_LOC}/lib/aopalliance-1.0.jar
    ${LIB_EXT_LOC}/lib/spring-web-3.0.7.RELEASE.jar
    ${LIB_EXT_LOC}/lib/commons-logging-1.1.1.jar
    ${LIB_EXT_LOC}/lib/cxf-2.6.3.jar
    " />

     

    <propertyregex property="the.sharedLib.classpath"
    input="${general.classpath}"
    regexp="   " replace="${line.separator}" global="true" />

     

     

    <wsadmin

    wasHome="${was_home}"
    script="C:/Users/*******/Desktop/addSharedLib.py"
    conntype="${conntype}"
    host="${host}" port="${port}"
    user="${user}" password="${password}" >
     
    <arg value="${cellName}" />
    <arg value="${application_SharedLibs}" />
    <arg value="${the.sharedLib.classpath}" />
    </wasadmin>
  • bpaskin
    bpaskin
    4059 Posts

    Re: Jacl Script Issues when trying to Set Shared Library Classpath

    ‏2013-04-19T16:54:21Z  

    Thanks for the speedy reply.  However I have run into a new issue.  My classpath itself is set up within the ANT script as a property to look like what is is below.  It is the reformated within the ant script to append a line separator at the end of every line just like it would be done in the WAS Console.  However, when i pass this property as an argument to my script, i get the following error: "SyntaxError: Lexical error at line 1, column 59.  Encountered: "\r" (13), after : "" ".. Any Ideas?

     

    <property name="general.classpath" value="
    ${LIB_EXT_LOC}/lib/aopalliance-1.0.jar
    ${LIB_EXT_LOC}/lib/spring-web-3.0.7.RELEASE.jar
    ${LIB_EXT_LOC}/lib/commons-logging-1.1.1.jar
    ${LIB_EXT_LOC}/lib/cxf-2.6.3.jar
    " />

     

    <propertyregex property="the.sharedLib.classpath"
    input="${general.classpath}"
    regexp="   " replace="${line.separator}" global="true" />

     

     

    <wsadmin

    wasHome="${was_home}"
    script="C:/Users/*******/Desktop/addSharedLib.py"
    conntype="${conntype}"
    host="${host}" port="${port}"
    user="${user}" password="${password}" >
     
    <arg value="${cellName}" />
    <arg value="${application_SharedLibs}" />
    <arg value="${the.sharedLib.classpath}" />
    </wasadmin>

    Hi, use a semicolon as a separator not a line return.  

    /tmp/my/path/jar1.jar;/tmp/jar2.jar

    Regards,

    Brian

  • Shaun_McEnhimer
    Shaun_McEnhimer
    3 Posts

    Re: Jacl Script Issues when trying to Set Shared Library Classpath

    ‏2013-04-19T18:05:17Z  
    • bpaskin
    • ‏2013-04-19T16:54:21Z

    Hi, use a semicolon as a separator not a line return.  

    /tmp/my/path/jar1.jar;/tmp/jar2.jar

    Regards,

    Brian

    Worked like a charm.  Thank you very much!