This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Websphere and the fly likes Help Needed with Jacl script. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Help Needed with Jacl script." Watch "Help Needed with Jacl script." New topic

Help Needed with Jacl script.

John Denver

Joined: Oct 01, 2007
Posts: 1
Trying to automate Message listener port creation.

I can run these commands while inside of wsadmin, and everything works fine:

set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
set mls [$AdminConfig list MessageListenerService $server]
set new [$AdminConfig create ListenerPort $mls {{name my} {destinationJNDIName di} {connectionFactoryJNDIName jndi/fs}}]
$AdminConfig create StateManageable $new {{initialState START}}

When I try to pass a vaiable as the name of the Listner port I get this error: ADMG0012E: The attribute value for attribute name is not valid.

It seems like nothing is getting passed to the variables, everything fails.

This is the script I have:

proc setupLP { node server name DJNDI CFJNDI mR mS mM } {
global AdminConfig

set server [$AdminConfig getid /Node:$node/Server:$server/]
set mls [$AdminConfig list MessageListenerService $server]

set new [$AdminConfig create ListenerPort $mls {{name $name} {destinationJNDIName $DJNDI} {connectionFactoryJNDIName $CFJNDI}}]
$AdminConfig create StateManageable $new {{initialState START}}

set lports [$AdminConfig showAttribute $mls listenerPorts]
set lport [lindex $lports 0]
$AdminConfig modify $lport {{maxRetries $mR}}
$AdminConfig modify $lport {{maxSessions $mS}}
$AdminConfig modify $lport {{maxMessages $mM}}
Paresh Wankhede

Joined: Sep 08, 2006
Posts: 12
Try using this. It is working fine for me....


global AdminConfig

set widCell [string trim [$props getProperty]]
set widNode [string trim [$props getProperty]]
set widServer [string trim [$props getProperty]]

set cell [$AdminConfig getid "/Cell:$widCell/"]
set node [$AdminConfig getid /Cell:$widCell/Node:$widNode/]
set server [$AdminConfig getid /Cell:$widCell/Node:$widNode/Server:$widServer/]

set mls [$AdminConfig list MessageListenerService $server]

set listenerConfigNos [string trim [$props getProperty listener.config.nos]]

for {set i 1} {$i <= $listenerConfigNos} {incr i} {

set listenerName [string trim [$props getProperty listener.$]]
set initialState [string trim [$props getProperty listener.$i.initialState]]
set description [string trim [$props getProperty listener.$i.description]]
set connectionFactoryJNDIName [string trim [$props getProperty listener.$i.connectionFactoryJNDIName]]
set destinationJNDIName [string trim [$props getProperty listener.$i.destinationJNDIName]]
set maxMessages [string trim [$props getProperty listener.$i.maxMessages]]
set maxRetries [string trim [$props getProperty listener.$i.maxRetries]]
set maxSessions [string trim [$props getProperty listener.$i.maxSessions]]

$AdminConfig create ListenerPort $mls [list [list connectionFactoryJNDIName $connectionFactoryJNDIName] \
[list destinationJNDIName $destinationJNDIName] \
[list maxMessages $maxMessages] \
[list maxRetries $maxRetries] \
[list maxSessions $maxSessions] \
[list name $listenerName] \
[list description $description] \
[list stateManagement [list [list initialState $initialState]]]]

$AdminConfig save


Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

I like Paresh's suggestion. It should work.

Just for reference, I put together a bunch of JACL scripts that I either wrote, or 'borrowed' from various places. You might find something helpful there if you're doing alot of advanced scripting:

WebSphere JACL Scripts for Automated Administration of WAS

Kind regards,

-Cameron McKenzie
I agree. Here's the link:
subject: Help Needed with Jacl script.
It's not a secret anymore!