Advance wsadmin AdminControl MBean method calls fail
 Technote (troubleshooting)
 
Problem(Abstract)
The wsadmin administrative tool provides an interface for IBM® WebSphere® Application Server MBean methods.

Many MBean methods require wsadmin to handle complex Java™ Objects (such as Hashtable) as inputs or returns. When using the wsadmin AdminControl to invoke the method to execute these MBean functions, the calls can fail with the following message:

WASX7015E: Exception running command: "...."; exception information:
javax.management.RuntimeOperationsException
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: argument
type mismatch
 
Resolving the problem

A list of MBeans and methods for each bean can be seen here:

Invoke
Invokes the object operation by conforming the parameter list to the signature. Returns the result of the invocation.

Parameters: name -- java.lang.String; operationName -- java.lang.String; params -- java.lang.String; sigs -- java.lang.String
Return Type: java.lang.String

The params input parameters for the MBean method, when using the AdminControl invoke method, cast all inputs as a String when the MBean method expected a complex Java object.

Review the AdminControl command from the Information Center.

The invoke_jmx function accomplishes the goal:

invoke_jmx
Invokes the object operation by conforming the parameter list to the signature. Returns the result of the invocation.

Parameters: name -- ObjectName; operationName -- java.lang.String; params -- java.lang.Object[]; signature -- java.lang.String[];
Return Type: java.lang.Object

This function accepts and returns the complexJava objects required for wsadmin to invoke some of the MBean methods.

Below is an example command to get the Enterprise Application information using JACL with wsadmin:

set a [$AdminControl queryNames type=AppManagement,*]
set objName [java::new javax.management.ObjectName $a]
set perfs [java::new java.util.Hashtable]
set l [list adminconsole $perfs ""]
set params [java::new {Object[]} 3 $l]
set signature [java::new {java.lang.String[]} 3 {java.lang.String java.util.Hashtable java.lang.String}]
set out [$AdminControl invoke_jmx $objName getApplicationInfo $params $signature]
set vec [java::cast java.util.Vector $out]
set e0 [$vec elementAt 0]
set roles [java::cast com.ibm.ws.management.application.client.MapRolesToUsers $e0]
set rolesMatrix [$roles getTaskData]
set l1 [$rolesMatrix length]
for {set x 0} {$x<$l1} {incr x} {
puts $x
set rolesString [$rolesMatrix get $x]
puts $rolesString
set l2 [$rolesString length]
for {set y 0} {$y<$l2} {incr y} {
set outputString [$rolesString get 1]
puts $outputString

}
}

You must use the JACL java::cast command to properly set the return information to a Java object that can be manipulated.

 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Administrative Scripting Tools (for example: wsadmin or ANT)
Operating system(s): Windows
Software version: 5.1.1
Software edition:
Reference #: 1178326
IBM Group: Software Group
Modified date: Sep 12, 2004