[SNMP4J] org.snmp4j.MessageException: Unsupported message processing model: 0

Amos Davis adavi068 at gmail.com
Thu Feb 24 01:38:15 CET 2011


I am this exception when I try to send a pdu to my trap.
org.snmp4j.MessageException: Unsupported message processing model: 0.  This
is the line that is throwing the exception "snmp.send(pdu,target,null,
listener);" and here is the complete code in question.  A bump in the right
direction would be helpful.  Thanks.

    public void setValue(String targetAddress, String oid_string, String
action, String value){
    int state=0;
    try {
    //set Target
    CommunityTarget target = new CommunityTarget();  //creates new instance
of CommunityTarget
    target.setCommunity(new OctetString("public")); //sets community string
    target.setAddress(GenericAddress.parse(targetAddress)); //sets the
address of the CommunityTarget
    target.setVersion(SnmpConstants.version1); // sets the version of the
PDU to be used
    MessageDispatcherImpl x =new MessageDispatcherImpl();
    Snmp snmp = new Snmp(x);
    PDU pdu = new PDU();
    OID oid = new OID(new OID(oid_string));
    Variable value_variable = new UnsignedInteger32(new Integer(value));
    pdu.add(new VariableBinding(oid,value_variable)); // binds oid and value
into pdu
    pdu.setType(PDU.SET);

    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.listen();
    snmp.send(pdu,target,null, listener);

    }
    catch (java.io.IOException e){
    System.out.println("Here is the error -- " + e);
    }
    }



More information about the SNMP4J mailing list