Link to home
Start Free TrialLog in
Avatar of k_satish22
k_satish22

asked on

Jython Script

Hello HonorGod,
Thank you very much for help on my previous questions.

Now I am looking for a script to take properties files as input to configure NameSpaceBinding and MQ Queue Configurations. I have 1200 different NameSpaceBinding to be configured and 1200 MQ Queue to be configured.  You help will be highly appreciated.

Script -1

Script to create NameSpaceBinding by taking input from Properties files.
Command :
AdminConfig.create('StringNameSpaceBinding', AdminConfig.getid('/Cell:Proc01/Node:wps1Node01/Server:server1/'), '[[name "CACHE_SWITCH"] [nameInNameSpace "CACHE_SWITCH"] [stringToBind "ON"]]')

The Properties file will contain –
Scope=
             Name: nameInNameSpace, stringToBind
Property:Value= CACHE_SWITCH, CACHE_SWITCH,ON


Script-2
Need a script to Create MQ Queues by taking properties from properties file.
Command –
Example
AdminTask.createWMQQueue('Proc1(cells/Proc1|cell.xml)', '[-name Queue1 -jndiName Queue1 -queueName Queue1 -qmgr QMGR1 -description -customProperties [[MDREAD YES] [MDMSGCTX SET_ALL_CONTEXT] [MSGBODY MQ]]]')

For the this script in the properties file will have

Scope=
  Name:Destination JNDI Name,Qmgr name,Base queue name,Targate client, MDREAD, MDMSGCTX, MSGBODY
Property:Value=Queue1:Queue1,QMG1,Queue1,JMS, YES, SET_ALL_CONTEXT, MQ

MDREAD, MDMSGCTX and MSGBODY are custom properties.
Avatar of HonorGod
HonorGod
Flag of United States of America image

> I have 1200 different NameSpaceBinding to be configured and 1200 MQ Queue to be configured.

  Are you sure you don't want to do this manually?  ;-)

ok, will the properties file to be processed by script 1 have mult-line entries?

----------------------------------------------------------------------
Scope= Name: nameInNameSpace, stringToBind
Property:Value= CACHE_SWITCH, CACHE_SWITCH,ON
----------------------------------------------------------------------

- Does the Scope entry identify the scope of a namespace binding to be created?
- Are there multiple Scope entries in the file?
- Is the order guaranteed to be that shown above?
- How do the "values" for the scope record relate to the create() parameters?

  Can you related the entries from the Scope and Property records to the following (just to help me understand)?
parent = AdminConfig.getid( '/Cell:Proc01/Node:wps1Node01/Server:server1/' )
attr   = '[[name "CACHE_SWITCH"] [nameInNameSpace "CACHE_SWITCH"] [stringToBind "ON"]]'
AdminConfig.create('StringNameSpaceBinding', parent, attr )

Open in new window

Avatar of k_satish22
k_satish22

ASKER

Please find my answers below...
- Does the Scope entry identify the scope of a namespace binding to be created?
Yes.
- Are there multiple Scope entries in the file?
No
- Is the order guaranteed to be that shown above?
The oder should not be changed. If you have some other idea that you can yo use it.
- How do the "values" for the scope record relate to the create() parameters?
please find the attached script and properties file. They may help you.

createMQ.py
createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.properties]"

createMQ: INFO --- In main function

createMQ: INFO --- Loading the properties to Hash Map => START......

createMQ: INFO --- Loading the properties to Hash Map => DONE.


createMQ: INFO --- Adding property value to servers START......

WASX7017E: Exception received while running file "createMQ.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<string>", line 129, in ?
  File "<string>", line 122, in main
  File "<string>", line 46, in createPropValues
java.lang.IllegalAccessException: Class org.python.core.PyReflectedFunction can not access a member of class java.util.HashMap$AbstractMapIterator with modifiers "public"
        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
        at java.lang.reflect.Method.invoke(Method.java:591)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
        at org.python.core.PyMethod.__call__(PyMethod.java)
        at org.python.core.PyObject.__call__(PyObject.java)
        at org.python.core.PyInstance.invoke(PyInstance.java)
        at org.python.pycode._pyx47.createPropValues$2(<string>:46)
        at org.python.pycode._pyx47.call_function(<string>)
        at org.python.core.PyTableCode.call(PyTableCode.java)
        at org.python.core.PyTableCode.call(PyTableCode.java)
        at org.python.core.PyFunction.__call__(PyFunction.java)
        at org.python.pycode._pyx47.main$5(<string>:122)
        at org.python.pycode._pyx47.call_function(<string>)
        at org.python.core.PyTableCode.call(PyTableCode.java)
        at org.python.core.PyTableCode.call(PyTableCode.java)
        at org.python.core.PyFunction.__call__(PyFunction.java)
        at org.python.pycode._pyx47.f$0(<string>:129)
        at org.python.pycode._pyx47.call_function(<string>)
        at org.python.core.PyTableCode.call(PyTableCode.java)
        at org.python.core.PyCode.call(PyCode.java)
        at org.python.core.Py.runCode(Py.java)
        at org.python.core.Py.exec(Py.java)
        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
        at com.ibm.bsf.engines.jython.JythonEngine$BSFPythonInterpreter.exec(Unknown Source)
        at com.ibm.bsf.engines.jython.JythonEngine.exec(Unknown Source)
        at com.ibm.bsf.BSFManager$6.run(Unknown Source)
        at java.security.AccessController.doPrivileged(AccessController.java:251)
        at com.ibm.bsf.BSFManager.exec(Unknown Source)
        at com.ibm.ws.scripting.AbstractShell.executeScript(AbstractShell.java:1189)
        at com.ibm.ws.scripting.AbstractShell.run(AbstractShell.java:2202)
        at com.ibm.ws.scripting.WasxShell.main(WasxShell.java:1010)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)
        at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)
        at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
        at org.eclipse.core.launcher.Main.run(Main.java:977)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:340)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:110)

java.lang.IllegalAccessException: java.lang.IllegalAccessException: Class org.python.core.PyReflectedFunction can not access a member of class java.util.HashMap$AbstractMapIterator with modifiers "public"
ok, it's going to take me a bit to get my head around your code.  Thanks for providing it.
hm.   Can I make extensive changes to your code?

Or, do you prefer for me to make minimum changes?
It appears that you prefer Java constructs to Jython ones.
Is that what you prefer that I use?  Or should I, as part of the modification, use Jython idioms, instead?
I just send that script as an example. You can use which every is easy and convient for you.
Hello HonorGod,
Any luck? If you can give me the scripts today that will be highly appreciated. I have some deadline to meet.  I am really sorry for the rush.

Thanks
Something like this perhaps?
createMQ.py
Thank you HonorGod for the script. But when I am executing the script  it is failing with below information.

 ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1
Error: Unexpected number of parameters: 1
Command: createMQ.txt

Purpose: Use the information from the specified properties file, and use it to
         create the specified MQ items.

  Usage: wsadmin -f createMQ.txt.py <propertiesFileName>

Example: ./wsadmin.sh -f createMQ.txt.py createMQ.txt.txt
oops.  Sorry.

I also realized that I forgot to call save() or do a sync()... sigh

Please forgive my earlier attempt
createMQ.py
Now it is failing with below error

$ ./wsadmin.sh -lang jython -f /opt/app/IBM/WebSphere/ProcDmgr70/profiles/ProcDmgr01/bin/createMQ.py /opt/app/IBM/WebSphere/ProcDmgr70/profiles/ProcDmgr01/bin/createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[/opt/app/IBM/WebSphere/ProcDmgr70/profiles/ProcDmgr01/bin/createMQ.txt]"
WASX7017E: Exception received while running file "/opt/app/IBM/WebSphere/ProcDmgr70/profiles/ProcDmgr01/bin/createMQ.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  (no code object) at line 0
  File "<string>", line 179
            if ( node no in [ 'was_dmgr_node', 'wps_dmgr_node' ] :
                      ^
stupid, stupid, stupid...

That line should be:

if node not in [ 'was_dmgr_node', 'wps_dmgr_node' ] :


createMQ.py
Now I am getting below Error.

$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1
WASX7017E: Exception received while running file "createMQ.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<string>", line 214, in ?
IndexError: index out of range: 1
That's what I get for testing with Jython, and not wsadmin :-(
createMQ.py
Thank you so much for the script. But when I am setting the Scope to Cell it failing with below error.

$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: INFO --- processing queue names

WASX7017E: Exception received while running file "createMQ.py"; exception information: com.ibm.ws.scripting.ScriptingException: Invalid object name: /Cell:ProcCell01/ProcCell01/JMSProvider:WebSphere MQ JMS Provider
I am sorry. The issues is with the properties file Now I corrected. But I am getting below error.
$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: INFO --- processing queue names


createMQ: ERROR --- Unable to get WebSphere MQ JMS Provider at the scopeCell:ProcCell01specified.Check the logs for more information.

createMQ: ERROR --- Unable to get WebSphere MQ JMS Provider at the scopeCell:ProcCell01specified.Check the logs for more information.

createMQ: ERROR --- Unable to get WebSphere MQ JMS Provider at the scopeCell:ProcCell01specified.Check the logs for more information.

createMQ: INFO --- Saving configuration changes.

createMQ: Enter SynchNodes().

createMQ: ERROR --- Unable to synchronise with node dmgr1ProcNode01. Nodeagent appears inactive.

createMQ: SUCCESS --- Synchronization successfull with Node wps01Node01

createMQ: SUCCESS --- Synchronization successfull with Node wps02Node01

createMQ: Exit  SynchNodes().

createMQ: INFO --- Exit  main() 3 error(s) encountered
hm.  Super.  Thanks for the output.

I'm checking line 75, now that I have access to my AppServer...

I think that it should be as shown below.

One moment please.
mqjmsp = AdminConfig.getid( '/Cell:%s/%s/JMSProvider:WebSphere MQ JMS Provider/' % ( cellName, scope )

Open in new window

Ah.  Thanks for the update.

What is the output for serverStatus for all profiles?

To list all configured profile names, you can use:

*ix:
  ./manageprofiles.sh -listProfiles

Windows:

  manageprofiles -listProfiles

Then, for each profile name listed, use:

*ix:
  ./serverStatus.sh -all -profileName <profileName>

Windows
  serverStatus -all -profileName <profileName>

e.g.,
  serverStatus -all -profileName AppSrv01
This will provide us with more information!
createMQ.py
After executing the above script I am getting the same error with more details. Please find the attached file for the results.

One More thing, for my second script on NameSpaceBinding do you have any script to export NameSpaceBinding from one Server and Import them to diffrent server. Instead of creating the NameSpaceBindings. I want to export all NameSpaceBindings  at diffrent scopes and import them at the same scops.
Thank you very much for all your help.
OutPut.txt
The problem is that in your input (Properties) file, you have scope as

Cell:ProcCell01

Which isn't what is needed.

Since the valid/configured MQ JMS Providers are as shown below, that the scope should be something like:

clusters/Rules_Cluster

or

clusters/NonClaims_Cluster

Does this make sense?
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Claims_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Cots_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/ME_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/NonClaims_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Rules_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/dmgr1ProcNode01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Claims1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Cots1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/ME1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/NonClaims1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Rules1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Claims2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Cots2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/ME2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/NonClaims2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Rules2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01|resources.xml#builtin_mqprovider)"

Open in new window

The Script is working fine at Node and Server level  when using
Scope=Node:wps01Node01
or
Scope=Node:wps01Node01/Server:Cots1



$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: INFO --- processing queue names


createMQ: SUCCESS ---Created the Queue Sample1 at scope Node:wps01Node01/Server:Cots1

createMQ: SUCCESS ---Created the Queue Sample2 at scope Node:wps01Node01/Server:Cots1

createMQ: SUCCESS ---Created the Queue Sample3 at scope Node:wps01Node01/Server:Cots1

createMQ: INFO --- Saving configuration changes.

createMQ: Enter SynchNodes().

createMQ: ERROR --- Unable to synchronise with node dmgr1ProcNode01. Nodeagent appears inactive.

createMQ: SUCCESS --- Synchronization successfull with Node wps01Node01

createMQ: SUCCESS --- Synchronization successfull with Node wps02Node01

createMQ: Exit  SynchNodes().

createMQ: INFO --- Exit  main() no error(s) encountered
good.

So, what's next?
Please note:
This error message is because of the way you originally had the SynchNode() check for the DM nodename.
I used the same kind of test.  

createMQ: ERROR --- Unable to synchronise with node dmgr1ProcNode01. Nodeagent appears inactive.

If you want the code to correctly detect (and not try to synch) the DM, change line 182 from this:

    if node not in [ 'was_dmgr_node', 'wps_dmgr_node' ] :

To correctly identify the DM node name(s), e.g.,

    if node not in [ 'dmgr1ProcNode01', 'wps_dmgr_node' ] :

You might even be able to get by with something like:

    if node.find( 'dmgr' ) < 0 :

Which only tries to synch for nodes what have a name that doesn't include "dmgr" somewhere in the node name.

Does that make sense?
The Script is not working at Cell Scope.

Cell:ProcCell01
Ah, that's because the script, as originally written, didn't take that into account, and therefore I didn't consider it.  One moment please
One more thing: The script is not taking the custom properties "'MDREAD', ' MDMSGCTX', ' MSGBODY'


$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: INFO --- processing queue names


createMQ: ERROR --- Unexpecited roles specified: ['queue/sample_sat', 'INKMW00', 'NKM.ACQUISITION.WAS', 'JMS', 'MDREAD', ' MDMSGCTX', ' MSGBODY']

createMQ: INFO --- Saving configuration changes.

createMQ: Enter SynchNodes().

createMQ: ERROR --- Unable to synchronise with node dmgr1ProcNode01. Nodeagent appears inactive.

createMQ: SUCCESS --- Synchronization successfull with Node wps01Node01

createMQ: SUCCESS --- Synchronization successfull with Node wps02Node01

createMQ: Exit  SynchNodes().

createMQ: INFO --- Exit  main() 1 error(s) encountered
I wonder if it would work for the cell if the scope were specified as

nodes/dmgr1ProcNode01
> The script is not taking the custom properties "'MDREAD', ' MDMSGCTX', ' MSGBODY'

When the Properties file contains these properties:

['queue/sample_sat', 'INKMW00', 'NKM.ACQUISITION.WAS', 'JMS', 'MDREAD', ' MDMSGCTX', ' MSGBODY']

Then I understand the stuff shown below.

However, you haven't told me how the rest are to be interpreted...
'queue/sample_sat'    == qjndiname
'INKMW00'             == qManager
'NKM.ACQUISITION.WAS' == bqname
'JMS'                 == tclient

Open in new window

My Bad I am sorry. Can you please include them.  These values also can be hardcoded.

 MDREAD =  YES,
MDMSGCTX =  SET_ALL_CONTEXT
 MSGBODY =  MQ

-customProperties [[MDREAD YES] [MDMSGCTX SET_ALL_CONTEXT] [MSGBODY MQ]]


I think the issue with the script is the script was initially developed configured at node level so it is not working at Cell level

mqjmsp = AdminConfig.getid( '/Cell:%s/%s/JMSProvider:WebSphere MQ JMS Provider/' % ( cellName, scope ) )

In the script it is taking the Scope for Node as  Node:wps01Node01 and it working fine
mqjmsp = AdminConfig.getid( '/Cell:Node/wps01Node01/JMSProvider:WebSphere MQ JMS Provider/' % ( cellName, scope ) )

When comming to Cell it is failing  because of follwing issue. it taking Cell:Cell/ProcCell01 Instead of /Cell:ProcCell01

mqjmsp = AdminConfig.getid( '/Cell:Cell/ProcCell01/JMSProvider:WebSphere MQ JMS Provider/' % ( cellName, scope ) )
I'm (very) surprised that

/Cell:Node/wps01Node01/

appears to work.  The proper syntax is:

/Cell:/Node:wps01Node01/

or even better:

/Node:wps01Node01/

The statements you are showing appear to have been modified.  The ones that I show in the code are:

mqjmsp = AdminConfig.getid( '/Cell:%s/%s/JMSProvider:WebSphere MQ JMS Provider/' % ( cellName, scope ) )

which should cause the following string substitution to occur:

...

So, if we look at the point shown above (i.e.,  https://www.experts-exchange.com/questions/26928348/Jython-Script.html?cid=1572&anchorAnswerId=35314539#a35314539) identifies all of the valid configuration ID's for the configured MQ JMS Providers.
'/Cell:%s/%s/JMSProvider:WebSphere MQ JMS Provider/' % ( cellName, scope )

The value of cellName should be put in place of the first %s, and the value of scope should be put in place of the 2nd %s.  So, if "cellName" is ProcCell01, the first phase of the substitution would have the string looking something like:

'/Cell:ProcCell01/%s/JMSProvider:WebSphere MQ JMS Provider/'
                  ^^

The question is, at this point, what value of scope should we use/supply to identify that actual destination to be used.

Open in new window

We need to supply below values in the properties file and the script should pick it from there.
CellName=ProcCell01
Scope=Node:dmgr1ProcNode01

Scope can be Cell, Node or Server
examples
Scope=Node:dmgr1ProcNode01
Server=Node:abcNode/Server:abcServer
Scope=Cell:ProcCell01
Why would you want to duplicate the cell if you want the cell scope?

CellName=ProcCell01
Scope=Cell:ProcCell01
hmm. I dont want to duplicate.  I thought it is a Mandatory value to be passed.
As a matter of fact, unless you are using something like Hypervisor Edition (www.IBM.com/software/webservers/appserv/hypervisor), then there will only be 1 Cell.
I have only one cell.
So, the question is:

When you want the configuration scope to the the cell, what are the preferred values (in the Properties) file of CellName and Scope?
In fact, if the server name is unique (i.e., only exists in one node), then you shouldn't even have to specify (qualify) the server name with the node name.

The script could even figure it out.

What if you had:

CellName=
NodeName=
ServerName=
ClusterName=

in the first part of the Properties file, as well as something like:

Scope=(Cell|Cluster|Node|Server)
I have a cluster environment and AppServer name are unique on nodes. If script can parse the values to proper nodes/servers then it is ok for me. Thanks alot for your help.
Hi HonorGod,

Do you have a script handy to import and report Namespace Bindings from one environment other.

Thanks
Do you, by any chance, mean detail information about the configured NameSpaceBinding objects?


print AdminConfig.list( 'NameSpaceBinding' )

Open in new window

I need a script to export and import Namespace Bindings from one environment other.

ok, that's a different question...

I'm not quite done with this one, at least not yet... ;-)
Do me a favor though, when you open that new question, please include the output of the following.

Thanks
for ns in AdminConfig.list( 'NameSpaceBinding' ).splitlines() :
  print ns
  print '-' * 50
  print AdminConfig.show( ns )
  print '-' * 50
  print

Open in new window

Any Luck with the script... I am sorry to rush you, as I need accomplish my task by tomorrow.
This version attempts to do what was discussed above (i.e., http://e-ecom/Q_26928348.html#a35316498)

i.e., To define the scope in the properties file, provide the appropriate values of:
CellName, ClusterName, NodeName, and ServerName

Then, the value of Scope in the properties file must be 1 of:
  Cell        - CellName  is required
  Cluster  - ClusterName  is required, CellName is optional
  Node     - NodeName  is required, CellName is optional
  Server   - ServerName is required, CellName and NodeName are optional

Let's see if this works for you.
createMQ.py
Thank you for the script.

If I Want to define the scope at cell level then what I need to specify the properties file?
The values in the properties file are....
CellName=ProcCell01
Scope=ProcCell01
Property:Value=Sample_sat:queue/sample_sat,INKMW00,NKM.ACQUISITION.WAS,JMS

when I try to use Cell as scope I am getting below error.
$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Error unexpected "Scope" value: ProcCell01
WASX7017E: Exception received while running file "createMQ.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<string>", line 284, in ?
  File "<string>", line 155, in main
NameError: configID
Q: If I Want to define the scope at cell level then what I need to specify the properties file?

CellName=rocCell01
Scope=Cell
Sorry, there was a typographical error on line 155

configID should be scopeID, so the line should be:


Note: The indentation was right!
if scopeID :

Open in new window

Now I am getting follow error.

./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: ERROR --- Unable to locate WebSphere MQ JMS Provider at the specified scope. Check the logs for more information.

createMQ: Debug - configured JMSProviders:
--------------------------------------------------
"WebSphere JMS Provider(cells/ProcCell01/clusters/Claims_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/clusters/Cots_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/clusters/ME_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/clusters/NonClaims_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/clusters/Rules_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/dmgr1ProcNode01|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Claims1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Cots1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/ME1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/NonClaims1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Rules1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Claims2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Cots2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/ME2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/NonClaims2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Rules2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01|resources.xml#builtin_jmsprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Claims_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Cots_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/ME_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/NonClaims_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Rules_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/dmgr1ProcNode01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Claims1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Cots1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/ME1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/NonClaims1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Rules1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Claims2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Cots2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/ME2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/NonClaims2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Rules2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01|resources.xml#builtin_mqprovider)"
--------------------------------------------------

createMQ: INFO --- Saving configuration changes.

createMQ: Enter SynchNodes().

createMQ: ERROR --- Unable to synchronise with node dmgr1ProcNode01. Nodeagent appears inactive.

createMQ: SUCCESS --- Synchronization successfull with Node wps01Node01

createMQ: SUCCESS --- Synchronization successfull with Node wps02Node01

createMQ: Exit  SynchNodes().

createMQ: INFO --- Exit  main(), 1 error(s) encountered.
Revised debug output to better understand what is occurring.
createMQ.py
here is the output...
$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: ERROR --- Unable to locate WebSphere MQ JMS Provider at the specified scope. Check the logs for more information.

createMQ: Debug Begin:
ProcCell01(cells/ProcCell01|cell.xml#Cell_1)
--------------------------------------------------
"WebSphere JMS Provider(cells/ProcCell01/clusters/Claims_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/clusters/Cots_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/clusters/ME_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/clusters/NonClaims_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/clusters/Rules_Cluster|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/dmgr1ProcNode01|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Claims1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Cots1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/ME1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/NonClaims1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Rules1|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps01Node01|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Claims2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Cots2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/ME2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/NonClaims2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Rules2|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01/nodes/wps02Node01|resources.xml#builtin_jmsprovider)"
"WebSphere JMS Provider(cells/ProcCell01|resources.xml#builtin_jmsprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Claims_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Cots_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/ME_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/NonClaims_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/clusters/Rules_Cluster|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/dmgr1ProcNode01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Claims1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Cots1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/ME1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/NonClaims1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01/servers/Rules1|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps01Node01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Claims2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Cots2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/ME2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/NonClaims2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01/servers/Rules2|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01/nodes/wps02Node01|resources.xml#builtin_mqprovider)"
"WebSphere MQ JMS Provider(cells/ProcCell01|resources.xml#builtin_mqprovider)"
--------------------------------------------------

createMQ: Debug Finish:

createMQ: INFO --- Saving configuration changes.

createMQ: Enter SynchNodes().

createMQ: ERROR --- Unable to synchronise with node dmgr1ProcNode01. Nodeagent appears inactive.

createMQ: SUCCESS --- Synchronization successfull with Node wps01Node01

createMQ: SUCCESS --- Synchronization successfull with Node wps02Node01

createMQ: Exit  SynchNodes().

createMQ: INFO --- Exit  main(), 1 error(s) encountered.
Very strange, that last config ID should match...
createMQ.py
Now I got below error
./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Cell" ) == ProcCell01(cells/ProcCell01|cell.xml#Cell_1)
WASX7017E: Exception received while running file "createMQ.py"; exception information: com.ibm.ws.scripting.ScriptingException: Invalid object name: /Cell:/<function scope at 471997474>/JMSProvider:WebSphere MQ JMS Provider/MQQueue:Sample_sat/
You're making me work... ;-)
createMQ.py
I am really sorry about that. I really need this script.
still getting the same error. :(
$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Cell" ) == ProcCell01(cells/ProcCell01|cell.xml#Cell_1)

createMQ: Debug: createMQ( "ProcCell01(cells/ProcCell01|cell.xml#Cell_1)", "Sample_sat", "['queue/sample_sat', 'INKMW00', 'NKM.ACQUISITION.WAS', 'JMS']" )
WASX7017E: Exception received while running file "createMQ.py"; exception information: com.ibm.ws.scripting.ScriptingException: Invalid object name: /Cell:/<function scope at 546709654>/JMSProvider:WebSphere MQ JMS Provider/MQQueue:Sample_sat/


I think somthing to do with command used to create the Queue destination. If I execute the below command it is working fine.
AdminTask.createWMQQueue('ProcCell01(cells/ProcCell01|cell.xml#Cell_1)', '[-name HonorGod -jndiName HonorGod -queueName sample1 -qmgr Sample -description -customProperties [[MDREAD YES] [MDMSGCTX SET_ALL_CONTEXT] [MSGBODY MQ]]]')
'HonorGod(cells/ProcCell01|resources.xml#MQQueue_1302035665579)'
ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so much the script is working for Cell scope. But it is not working at when I am specifying Scope as Node as below. I am not sure whether I am specifying it correctly in the properties file or not .
Scope=wps01Node01
Nope,  Specify

Scope=Node

That's the beauty of using this technique.
We specify only the required names (e.g., CellName, NodeNode, ClusterName, and/or ServerName), then one of the corresponding Scope values:

Cell
Node
Cluster
Server
Sorry for the delayed response.  My machine died (BSoD) on me. ;-(
Excellent!!! The Scirpt is working fine.  You are Marvelous. Thank you somuch for helping me.
;-)

Thanks for the compliments, grade and points.

Good luck & have a great day.
I am sorry for commenting on this question, The script is not working. I am getting error is Queue Defination is already configured at  specified scope. Skipping the MQ Queue creation.


$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Node" ) == wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ", "['NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ.BKOUT", "['NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ.BKOUT', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ.BKOUT is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.ENROLLMENT.REQ.BKOUT", "['NHFA.UNIT.EN05.BATCH.ENROLLMENT.REQ.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.ENROLLMENT.REQ.BKOUT', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.ENROLLMENT.REQ.BKOUT is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.ENROLLMENT.REQUEST", "['NHFA.UNIT.EN05.BATCH.ENROLLMENT.REQUEST', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.ENROLLMENT.REQUEST', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.ENROLLMENT.REQUEST is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.ENROLLMENT.RESP.BKOUT", "['NHFA.UNIT.EN05.BATCH.ENROLLMENT.RESP.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.ENROLLMENT.RESP.BKOUT', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.ENROLLMENT.RESP.BKOUT is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.ENROLLMENT.RESPONSE", "['NHFA.UNIT.EN05.BATCH.ENROLLMENT.RESPONSE', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.ENROLLMENT.RESPONSE', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.ENROLLMENT.RESPONSE is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.SWIPECARD.FFA", "['NHFA.UNIT.EN05.BATCH.SWIPECARD.FFA', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.SWIPECARD.FFA', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.SWIPECARD.FFA is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.SWIPECARD.FFA.BKOUT", "['NHFA.UNIT.EN05.BATCH.SWIPECARD.FFA.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.SWIPECARD.FFA.BKOUT', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.SWIPECARD.FFA.BKOUT is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.SWIPECARD.PROCESS", "['NHFA.UNIT.EN05.BATCH.SWIPECARD.PROCESS', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.SWIPECARD.PROCESS', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.SWIPECARD.PROCESS is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.SWIPECARD.PROCESS.BKOUT", "['NHFA.UNIT.EN05.BATCH.SWIPECARD.PROCESS.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.SWIPECARD.PROCESS.BKOUT', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.BATCH.SWIPECARD.PROCESS.BKOUT is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.CNTYPMT.REQ", "['NHFA.UNIT.EN05.CNTYPMT.REQ', 'MQSHCU01', 'NHFA.UNIT.EN05.CNTYPMT.REQ', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.CNTYPMT.REQ is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.CNTYPMT.REQ.BKOUT", "['NHFA.UNIT.EN05.CNTYPMT.REQ.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.CNTYPMT.REQ.BKOUT', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.CNTYPMT.REQ.BKOUT is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.CNTYPMT.RSP", "['NHFA.UNIT.EN05.CNTYPMT.RSP', 'MQSHCU01', 'NHFA.UNIT.EN05.CNTYPMT.RSP', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.CNTYPMT.RSP is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.CNTYPMT.RSP.BKOUT", "['NHFA.UNIT.EN05.CNTYPMT.RSP.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.CNTYPMT.RSP.BKOUT', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.CNTYPMT.RSP.BKOUT is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.COBILL.ITEMS.REQ", "['NHFA.UNIT.EN05.COBILL.ITEMS.REQ', 'MQSHCU01', 'NHFA.UNIT.EN05.COBILL.ITEMS.REQ', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.COBILL.ITEMS.REQ is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.COBILL.ITEMS.REQ.BKOUT", "['NHFA.UNIT.EN05.COBILL.ITEMS.REQ.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.COBILL.ITEMS.REQ.BKOUT', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.COBILL.ITEMS.REQ.BKOUT is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.COBILL.ITEMS.RSP", "['NHFA.UNIT.EN05.COBILL.ITEMS.RSP', 'MQSHCU01', 'NHFA.UNIT.EN05.COBILL.ITEMS.RSP', 'JMS']" )

createMQ: INFO --- MQ Queue NHFA.UNIT.EN05.COBILL.ITEMS.RSP is already configured at specified scope. Skipping the MQ Queue creation.

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.COBILL.ITEMS.RSP.BKOUT", "['NHFA.UNIT.EN05.COBILL.ITEMS.RSP.BKOUT', 'MQSHCU01', 'NHFA.UNIT.EN05.COBILL.ITEMS.RSP.BKOUT', 'JMS']" )

revised to provide information about previously configured resource of the specified name:
createMQ.py
Thank you oncea agin for helping me out. Now I am getting below error.

createMQ: Debug: createMQ( "ProcCell01(cells/ProcCell01|cell.xml#Cell_1)", "NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ", "['NHFA.UNIT.BATCH.ELIGIBILITY.REQ', 'MQSHCS01', 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ', 'JMS']" )
WASX7017E: Exception received while running file "/opt/app/IBM/WebSphere/ACSProject/createMQ.py"; exception information: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: WASX7480E: """ found instead of expected [.
Attribute= had invalid value= for input parameter=['name' 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ'] ['jndiName' 'NHFA.UNIT.BATCH.ELIGIBILITY.REQ'] ['baseQueueName' 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ'] ['targetClient' 'JMS'] ['baseQueueManagerName' 'MQSHCS01'] "customProperties" [['MDREAD' 'YES'] ['MDMSGCTX' 'SET_ALL_CONTEXT'] ['MSGBODYMQ']]
 
If we display the attributes for an MQQueue, we see the following:

So I don't see where the "customProperties" you identified should exist...
.                      CCSID int                                                                      
.       baseQueueManagerName String                                                                   
.              baseQueueName String                                                                   
.                   category String                                                                   
.            decimalEncoding ENUM(Normal, Reversed)                                                   
.                description String                                                                   
.                     expiry ENUM(APPLICATION_DEFINED, SPECIFIED, UNLIMITED)                          
.      floatingPointEncoding ENUM(IEEENormal, IEEEReversed, S390)                                     
.            integerEncoding ENUM(Normal, Reversed)                                                   
.                   jndiName String                                                                   
.                       name String                                                                   
.                   password String                                                                   
.                persistence ENUM(APPLICATION_DEFINED, HIGH, NONPERSISTENT, PERSISTENT, QUEUE_DEFINED)
.                   priority ENUM(APPLICATION_DEFINED, SPECIFIED, QUEUE_DEFINED)                      
.                propertySet J2EEResourcePropertySet                                                  
.                   provider J2EEResourceProvider@                                                    
.               providerType String                                                                   
.           queueManagerHost String                                                                   
.           queueManagerPort int                                                                      
.                  readAhead ENUM(QUEUE_DEFINED, YES, NO)                                             
.             readAheadClose ENUM(DELIVERCURRENT, DELIVERALL)                                         
.                  sendAsync ENUM(QUEUE_DEFINED, YES, NO)                                             
.serverConnectionChannelName String                                                                   
.            specifiedExpiry long                                                                     
.          specifiedPriority int                                                                      
.               targetClient ENUM(JMS, MQ)                                                            
.          useNativeEncoding boolean                                                                  
.                   userName String

Open in new window

If we us wsadmin command intractivly we can see that option.  
Below command is working fine for me,

AdminTask.createWMQQueue('Proc1(cells/Proc1|cell.xml)', '[-name Queue1 -jndiName Queue1 -queueName Queue1 -qmgr QMGR1 -description -customProperties [[MDREAD YES] [MDMSGCTX SET_ALL_CONTEXT] [MSGBODY MQ]]]')
Ah, that's the problem!

Here, try this one. (I hope you don't have Triskaidekaphobia ;-)
createMQ.py
Still getting the same error.....
wasadmin@env5_dmgr1:bin$ ./wsadmin.sh -lang jython -f createMQ.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Node" ) == wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)

createMQ: Debug: createMQ( "wps02Node01(cells/ProcCell01/nodes/wps02Node01|node.xml#Node_1)", "NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ", "['NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ', 'JMS']" )
WASX7017E: Exception received while running file "createMQ.py"; exception information: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: WASX7480E: "-customProperties" found instead of expected [.
Attribute= had invalid value= for input parameter=['name' 'NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ'] ['jndiName' 'NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ'] ['baseQueueName' 'NHFA.UNIT.EN05.BATCH.ELIGIBILITY.REQ'] ['targetClient' 'JMS'] ['baseQueueManagerName' 'MQSHCU01'] -customProperties  [['MDREAD' 'YES'] ['MDMSGCTX' 'SET_ALL_CONTEXT'] ['MSGBODYMQ']]

ooh. I missed something.

Note how your "example" uses the AdminTask.createWMQQueue() method, instead of the AdminConfig.createUsingTemplate() one.

Can we change the input (properties) file format from this:

--------------------------------------------------------------------------------
Property:Value=Sample1:queue/sample1,INKMW00,NKM.ACQUISITION.WAS,JMS
Property:Value=Sample2:queue/sample2,INKMW00,NKM.ACQUISITION.WAS,JMS
Property:Value=Sample3:queue/sample3,INKMW00,NKM.ACQUISITION.WAS,JMS
--------------------------------------------------------------------------------

Which maps to

--------------------------------------------------------------------------------
Property:Value=<Qname>:<jndiname>,<qManager>,<bqname>,<tclient>
--------------------------------------------------------------------------------

To something that more closely matches the AdminTask.createWMQQueue() arguments?
Perhaps something like:

--------------------------------------------------------------------------------
Property:Value=<Name>:<jndiname>,<Qname>,<Qmgr>,<Persistence>,<Priority>,<Expiry>
--------------------------------------------------------------------------------

Please let me know.

Thanks!
Just in case you need it, here's the link to the Information Center to the AdminTask.createWMQQueue() method:

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rmj_wmq_jmswmqq_create.html
Changing properties file is not a problem. Please let me know which one to use.
Use the link shown above, and you tell me the ones you want/need.  Most are optional.
I need -
Name,
JNDI
QMGR
QUEUE
type
and -customproperties

Any luck with the script ?
I thinks to set the custom properties is the limitation in using template. I found this info in below link.http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14586071
hm..

To which AdminTask.createWMQQueu() parameter does the "type" mentioned above refer?
Name             = -name      : Required parm, ok
JNDI             = -jndiName  : Required parm, ok
QMGR             = -qmgr      : Optional parm, ok
QUEUE            = -queueName : Optional parm, ok
type             = This, I don't understand
-customproperties ... ok

Open in new window

type = targetClient ENUM(JMS, MQ)  
You can ignore it. Let us take it out.
I desperately need this script today. I need to meet my dead lines today. I am really sorry for the rush. Your help is highly appreciated.
ok, so the values after Property:Value should be:

Name,JNDI,QMGR,Queue

which relate to the corresponding arguments, as documented on this page of the Information Center: http://goo.gl/XCn5e
Name  = -name      : Required parm, ok
JNDI  = -jndiName  : Required parm, ok
QMGR  = -qmgr      : Optional parm, ok
QUEUE = -queueName : Optional parm, ok

Open in new window

createMQ.py
Let me know, ASAP, if it doesn't work for you.  Thanks!
Just came for lunch. Please give me 20 minutes. Thank you so much for your quick response.
Getting below error:

./wsadmin.sh -lang jython -port 28879 -username wpsbind -password passw0rd -f  createMQ_new.py MQ_input.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[MQ_input.txt]"
WASX7017E: Exception received while running file "createMQ_new.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  (no code object) at line 0
  File "<string>", line 81
            print 'qname, roles:', qname, roles print '-' * 50
                                                ^
SyntaxError: invalid syntax
Somehow 2 lines got joined...
createMQ.py
Now I am getting this error...
wasadmin@env57_dmgr1:bin$ ./wsadmin.sh -lang jython -port 28879 -username wpsbind -password passw0rd -f  createMQ_new2.py MQ_input.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[MQ_input.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file
WASX7017E: Exception received while running file "createMQ_new2.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<string>", line 289, in ?
  File "<string>", line 147, in main
  File "<string>", line 54, in Properties
ValueError: unpack sequence too short
argh...

Please attach your properties (input) file.
Why does your Property:Value have 5 (comma separated) values?

Previously, you had the Queue Name (1st parm) delimited by a ':'

Property:Value=Queue1:Queue1,QMG1,Queue1,JMS, YES, SET_ALL_CONTEXT, MQ

Do you want all of the stuff after "Property:Value=" comma separated?
NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ_satish
NHFA.UNIT.BATCH.ELIGIBILITY.REQ_satish
MQSHCS01
NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ
JMS

Open in new window

As per your comment  at 04/11/11 09:39 AM, ID: 35367917 I have change my properties.

Now I have changed it back to ":"After changing it I am gettting below error.

./wsadmin.sh -lang jython -port 28879 -username wpsbind -password passw0rd -f  createMQ_new2.py MQ_input.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[MQ_input.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Cell" ) == ProcCell01(cells/ProcCell01|cell.xml#Cell_1)

createMQ: Debug: createMQ( "ProcCell01(cells/ProcCell01|cell.xml#Cell_1)", "NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ_satish", "['NHFA.UNIT.BATCH.ELIGIBILITY.REQ_satish', 'MQSHCS01', 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ', 'JMS']" )

createMQ: ERROR --- Unexpected roles specified: ['NHFA.UNIT.BATCH.ELIGIBILITY.REQ_satish', 'MQSHCS01', 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ', 'JMS']

createMQ: INFO --- Saving configuration changes.

createMQ: Enter SynchNodes().

createMQ: ERROR --- Unable to synchronise with node dmgr1ProcNode01. Nodeagent appears inactive.

createMQ: SUCCESS --- Synchronization successfull with Node wps01Node01

createMQ: SUCCESS --- Synchronization successfull with Node wps02Node01

createMQ: Exit  SynchNodes().

createMQ: INFO --- Exit  main(), 1 error(s) encountered.
ok, what does your input file look like now, and what to the values after Property:Value= represent?
Property:Value=NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ_satish:NHFA.UNIT.BATCH.ELIGIBILITY.REQ_satish,MQSHCS01,NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ,JMS
ok, that answers the 1st part of the question, but not the second...

From that:
Name  = -name      : NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ_satish
JNDI  = -jndiName  : NHFA.UNIT.BATCH.ELIGIBILITY.REQ_satish
QMGR  = -qmgr      : MQSHCS01
QUEUE = -queueName : NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ


What, is this? JMS

Open in new window

type = targetClient ENUM(JMS, MQ) which ignored. I have removed JMS and tried it again I am getting below error. I think we are still using MQ template to create the queue destination.  custom properties is the limitation in using template. I think we can not set custom properties using the MQ template. I am not sure.

./wsadmin.sh -lang jython -port 28879 -username wpsbind -password passw0rd -f  createMQ_new2.py MQ_input.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[MQ_input.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Cell" ) == ProcCell01(cells/ProcCell01|cell.xml#Cell_1)

createMQ: Debug: createMQ( "ProcCell01(cells/ProcCell01|cell.xml#Cell_1)", "NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ_satish", "['NHFA.UNIT.BATCH.ELIGIBILITY.REQ_satish', 'MQSHCS01', 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ']" )
WASX7017E: Exception received while running file "createMQ_new2.py"; exception information: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: WASX7480E: "-customProperties" found instead of expected [.
Attribute= had invalid value= for input parameter=['name' 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ_satish'] ['jndiName' 'NHFA.UNIT.BATCH.ELIGIBILITY.REQ_satish'] ['baseQueueName' 'MQSHCS01'] ['baseQueueManagerName' 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ'] -customProperties  [['MDREAD' 'YES'] ['MDMSGCTX' 'SET_ALL_CONTEXT'] ['MSGBODYMQ']]
sorry for the typo -- type = targetClient ENUM(JMS, MQ) which can be ignored/removed
You are absolutely right.  Please accept my apologies.
I was rushed, and didn't check my work as completely as I should have
createMQ.py
Now I am getting this error.

wasadmin@env5_dmgr1:bin$ ./wsadmin.sh -lang jython -f createMQ_new3.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Cell" ) == ProcCell01(cells/ProcCell01|cell.xml#Cell_1)

createMQ: Debug: createMQ( "ProcCell01(cells/ProcCell01|cell.xml#Cell_1)", "NHFA.UNIT.EN05.BATCH.12", "['NHFA.UNIT.BATCH12', 'MQSHCU01', 'NHFA.UNIT.EN05.BATCH.REQ']" )
WASX7017E: Exception received while running file "createMQ_new3.py"; exception information: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: WASX7122E: Expected "-"  not found.
[['name' 'NHFA.UNIT.EN05.BATCH.12'] ['jndiName' 'NHFA.UNIT.BATCH12'] ['baseQueueName' 'MQSHCU01'] ['baseQueueManagerName' 'NHFA.UNIT.EN05.BATCH.REQ'] -customProperties  [['MDREAD' 'YES'] ['MDMSGCTX' 'SET_ALL_CONTEXT'] ['MSGBODYMQ']] ]
^
This should fix that error.
I am so sorry for the number of errors.
createMQ.py
still same error......

wasadmin@env5_dmgr1:bin$ ./wsadmin.sh -lang jython -f createMQ_new4.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Cell" ) == ProcCell01(cells/ProcCell01|cell.xml#Cell_1)

createMQ: Debug: createMQ( "ProcCell01(cells/ProcCell01|cell.xml#Cell_1)", "NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT", "['NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT', 'MQSHCU01', 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT']" )
WASX7017E: Exception received while running file "createMQ_new4.py"; exception information: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: WASX7122E: Expected "-"  not found.
[['-name' 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT'] ['-jndiName' 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT'] ['-baseQueueName' 'MQSHCU01'] ['-baseQueueManagerName' 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT'] -customProperties  [['MDREAD' 'YES'] ['MDMSGCTX' 'SET_ALL_CONTEXT'] ['MSGBODYMQ']] ]
^
I don't understand that error message.  It makes no sense.  When I used the '-interactive' option to step through the generation of the AdminTask.createWMQQueue() command the "generated" command looked like this:

ooh... wait a minute.

Alright, here's what I've done.
I've modified the createMQ() function, as well as the expected parameters from the properties file!!!

Here's a sample test of the routine from an interactive wsadmin session:

Things to note:
* The 1st value from the Properties file between the "=" and the ":" is the:

The administrative name assigned to this WebSphere MQ messaging provider queue type destination.

* The value after the ":" is the jndiName
* The value after the 1st comma is the queueName
* The value after the 2nd (last) comma is the qMgr
wsadmin>from cre8 import createMQ
wsadmin>cell = AdminConfig.list( 'Cell' )
wsadmin>createMQ( cell, 'myProvider', [ 'jndiName', 'queueName', 'qMgr' ] )

createMQ Debug: AdminTask.createWMQQueue( "ragweedCell02(cells/ragweedCell02|cell.xml#Cell_1)", "-name myProvider -jndiName jndi
Name -queueName queueName -customProperties [[MDREAD yes] [MDMSGCTX SET_ALL_CONTEXT] [MSGBODY MQ]]" )

createMQ: SUCCESS ---Created the Queue queueName at specified scope
0

Open in new window

AdminTask.createWMQQueue( scopeID, '[-name myQueue -jndiName  JNDIname -queueName queueName -customProperties [ [ MDREAD yes] [ MDMSGCTX SET_ALL_CONTEXT] [ MSGBODY MQ ] ] ]' )

Open in new window

createMQ.py
Now the issue is the not taking Qmgr value. In place of Queue Name it is talking Qmgr Name from the properties file. Please check the output below.

Values in properties file:
Property:Value=Nam:jndi,QMGR,Queue
Property:Value=NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT:NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT,MQSHCU01,NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT


 ./wsadmin.sh -lang jython -f createMQ_new5.py createMQ.txt
WASX7209I: Connected to process "dmgr" on node dmgr1ProcNode01 using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[createMQ.txt]"
argc: 1

createMQ: INFO --- Enter main()

createMQ: INFO --- Enter Properties() - load from Properties file

createMQ: INFO --- Exit  Properties()

createMQ: Debug  Scope( "Cell" ) == ProcCell01(cells/ProcCell01|cell.xml#Cell_1)

createMQ: Debug: createMQ( "ProcCell01(cells/ProcCell01|cell.xml#Cell_1)", "NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT", "['NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT', 'MQSHCU01', 'NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT']" )

createMQ Debug: AdminTask.createWMQQueue( "ProcCell01(cells/ProcCell01|cell.xml#Cell_1)", "-name NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT -jndiName NHFA.SYST.EN57.BATCH.ELIGIBILITY.REQ.BKOUT -queueName MQSHCU01 -customProperties [[MDREAD yes] [MDMSGCTX SET_ALL_CONTEXT] [MSGBODY MQ]]" )

createMQ: SUCCESS ---Created the Queue MQSHCU01 at specified scope

createMQ: INFO --- Saving configuration changes.

createMQ: Enter SynchNodes().

createMQ: ERROR --- Unable to synchronise with node dmgr1ProcNode01. Nodeagent appears inactive.

createMQ: SUCCESS --- Synchronization successfull with Node wps01Node01

createMQ: SUCCESS --- Synchronization successfull with Node wps02Node01

createMQ: Exit  SynchNodes().

createMQ: INFO --- Exit  main(), 0 error(s) encountered.
The script is working fine. But in place of QueueName it is taking qmgr and viceversa. Do I need to check the the values in properties file or it can be fixed in the code?
Are you saying that the order isn't what you expect?

The code is expecting:

Do you need that changed?
Property:Value=name:jndiName,qName,qMgr

Open in new window

No. I am just check whether the order can be chaged to Property:Value=Name:JNDI,QmgrName,QueueName
Not a problem. I have changed the values to
Property:Value=name:jndiName,qName,qMgr

Now the script is working absolutely fine. Thank you so much for you help. I am doing testing now. I will let you know the result by tomorrow.

ok, this version expects the Property values to be in this order:

Property:Value=name:jndiName,qName,qMgr

Use whichever version you prefer.

I really appreciate your patience, and willingness to continue working with me on this.
Thanks
createMQ.py
I am sorry for delayed response. I want out of country for few weeks.  Now the script is work fine. Thank you so much. I really appreciate it.
Super.  I'm glad to hear it.  I hope that you had a safe trip.