[SNMP4J] agent-jmx - method call with arguments

david pocivalnik dp.desoma at gmail.com
Thu Feb 28 09:31:22 CET 2013


Hi,

I've defined a method call that doesn't take any arguments successfully. 
Now I defined the following method

void startExport(String s);

and created the MOScalar as the one w/o any arguments

expCall = moFactory.createScalar(oidExpCall,			 
moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE), new 
Integer32());

and registered it.

in the *Inst.java class I added the OID to the ACTION_OIDS and created 
the following array:

private static final Object[][] SCALAR_MBEANS_EXP_ACTIONS = {
{ TestManagementMib.oidExpCall,	
new MBeanStateInfo[] { new MBeanStateInfo(2, null, null) },
new MBeanActionInfo[] { new MBeanActionInfo(4, "startExport", new 
Object[1]) } } };

I figured the first parameter in the new MBeanActionInfo can't be the 
same as the one used previously (which was 3), thus I increased it. 
Also, I though the integer in the Object[] defines the number of 
arguments that the method takes, thus i set it to one.

finally I added SCALAR_MBEANS_EXP_ACTIONS to scalarSupportActions.

Something must be wrong, as the Agent isn't starting. The following error:
Exception in thread "main" java.lang.ExceptionInInitializerError

when I set the number of arguments to 0 (Object[0]) then the agent 
starts successfully, but i can't pass along any argument, e.g.

$ snmpget someOID s myStringToPass

Thanks for any hints and BR
david



More information about the SNMP4J mailing list