[SNMP4J] Unsupported message processing model: 0
Ali Daher
alidaher at gebecom.de
Tue Dec 16 12:52:00 CET 2008
Hi all,
I want to send a request, but I am getting the following exception:
Exception in thread "main" org.snmp4j.MessageException: Unsupported message
processing model: 0
at org.snmp4j.MessageDispatcherImpl.sendPdu(Unknown Source)
at org.snmp4j.Snmp.sendMessage(Unknown Source)
at org.snmp4j.Snmp.send(Unknown Source)
at org.snmp4j.Snmp.send(Unknown Source)
at GET.main(GET.java:58)
even though I am setting the right version.
I have going around the documentation to see what I am missing, but I am not
finding anything wrong.
I need some help here whether I am missing something or I am doing something
wrong
Looking forward for your help
Here is my code
public static void main(String[] args) throws IOException {
Address targetAddress =
GenericAddress.parse("udp:192.168.178.14/161");
CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString("public"));
target.setAddress(targetAddress);
target.setRetries(2);
target.setTimeout(1500);
System.out.println(SnmpConstants.version1);
target.setVersion(SnmpConstants.version1);
// creating PDU
PDU pdu = new PDU();
pdu.add(new VariableBinding(new OID(new int[]
{1,3,6,1,2,1,1,1})));
pdu.add(new VariableBinding(new OID(new int[]
{1,3,6,1,2,1,1,2})));
pdu.setType(PDU.GET);
// sending request
ResponseListener listener = new ResponseListener() {
public void onResponse(ResponseEvent event) {
// Always cancel async request when response has been
received
// otherwise a memory leak is created! Not canceling a
request
// immediately can be useful when sending a request to
a broadcast
// address.
((Snmp)event.getSource()).cancel(event.getRequest(),
this);
System.out.println("Received response PDU is:
"+event.getResponse());
}
};
Snmp s= new Snmp();
listener.onResponse( s.send(pdu, target));
}
Thanks in advance
Regards
Ali
More information about the SNMP4J
mailing list