Snmp V3 getNext

Snmp V3 getNext

 
I am getting a null pointer exception in statement :
  SnmpVar var = result.getVariable(oid);
 
for snmp v3 that is
pdu.setCommand(SnmpAPI.GETNEXT_REQ_MSG);
 
while with 
 pdu.setCommand(SnmpAPI.GET_REQ_MSG);
 i can get values .
 
Does anybody have a idea what could be the problem.....