[SNMP4J] (no subject) IpAddress vs. UdpAddress

RobertoBouza at bayviewfinancial.com RobertoBouza at bayviewfinancial.com
Thu Apr 5 15:43:25 CEST 2007


Frank,

Thank you. I appreciate your prompt answer.

Now I'm facing something else... I'm getting this:

org.snmp4j.MessageException: Message processing model 3 returned error: 
-1402
        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 GetMIBValue.main(GetMIBValue.java:60)

I trying to figure out what that error means but no clue at all. It looks 
like the source is incorrect maybe I need to add the source TCP address to 
the transport?

Thank you again.

---
Roberto Bouza 
Middle Tier Administrator II
Bayview Financial, L.P.
4425 Ponce de Leon Blvd, 2nd Floor
Coral Gables, FL 33146
Ph. 305-644-2550



Frank Fock <fock at agentpp.com> 
Sent by: snmp4j-bounces at agentpp.org
04/05/07 01:49 AM

To
RobertoBouza at bayviewfinancial.com
cc
snmp4j at agentpp.org
Subject
Re: [SNMP4J] (no subject) IpAddress vs. UdpAddress






Hi,

You cannot communicate with an IpAddress as communication
endpoint. You need either an UdpAddress (default) or
a TcpAddress. IP is a network protocol, whereas UDP and TCP
are transport protocols.

Best regards,
Frank

RobertoBouza at bayviewfinancial.com wrote:
> Hello everyone,
> 
> I'm getting this Exception:
> 
> org.snmp4j.transport.UnsupportedAddressClassException: Unsupported 
address 
> class (transport mapping): org.snmp4j.smi.IpAddress
> 
> I'm pretty new to SNMP and developing using SNMP4J. I just want to make 
a 
> SNMP get of an OID variable from a server and I get this error when the 
> send methos is called on the snmp class. Here is the code:
> 
> Any help would be really appreciated.
> 
> ###########
> 
> public class GetMIBValue {
> 
>         public static void  main(String arg[]) {
> 
>                 try {
> 
>                 TransportMapping transport = new 
> DefaultTcpTransportMapping();
>                 Snmp snmp = new Snmp(transport);
> 
>                 // Since we are using SNMPv3 we use authenticated users 
> this is handled by the UsmUser and USM class
>                 UsmUser uu = new UsmUser(new OctetString("ssnmpreader"), 

> AuthMD5.ID, new OctetString("ssnmpread3r"), PrivDES.ID, new 
> OctetString("ssnmpread3r"));
> 
>                 if (uu == null) {
>                         System.out.println("Null UsmUser");
>                 } else {
>                         System.out.println("Valid UsmUser");
>                 }
> 
>                 USM usm = snmp.getUSM();
> 
>                 if (usm == null) {
>                         System.out.println("Null Usm");
>                 } else {
>                         usm = new USM(SecurityProtocols.getInstance(), 
new 
> OctetString(MPv3.createLocalEngineID()), 0);
>                         usm.addUser(new OctetString("ssnmpreader"), uu);
>                         System.out.println("Valid Usm");
>                 }
> 
>                 UserTarget target = new UserTarget();
>                 IpAddress ipa = new IpAddress("10.10.32.201");
>                 target.setAddress(ipa); 
> 
>                 if (target.getAddress().isValid()) {
>                         System.out.println("Valid IP address");
>                 } else {
>                         System.out.println("Invalid IP address");
>                 }
> 
>                 target.setRetries(1);
> 
>                 // set timeout to 500 milliseconds -> 2*500ms = 1s total 

> timeout
>                 target.setTimeout(500);
>                 target.setVersion(SnmpConstants.version3);
>                 target.setSecurityLevel(SecurityLevel.AUTH_PRIV);
>                 target.setSecurityName(new OctetString("MD5DES"));
> 
>                 // We create the basic PDU Unit
>                 ScopedPDU pdu = new ScopedPDU();
>                 pdu.add(new VariableBinding(new 
OID("1.3.6.1.2.1.1.1")));
>                 pdu.setType(PDU.GET);
> 
>                 // set non-default context engine ID (to use targets 
> authoritative engine ID
>                 // use an empty (size == 0) octet string)
>                 pdu.setContextEngineID(new 
> OctetString("0x80001f88803d4bf37386c41346"));
> 
>                 ResponseEvent response = snmp.send(pdu, target);
> 
>                 PDU responsePDU = response.getResponse();
> 
>          if (responsePDU == null) {
>                 } else {
>                         System.out.println("Received response from: "+ 
> response.getPeerAddress());
>                         System.out.println(responsePDU.toString());
>                 }
> 
>                 } catch (Exception exp) {
>                         System.out.println(exp.toString());
>                         System.out.println("-----------");
>                         exp.printStackTrace();
>                 }
>         }
> 
> }
> 
> ########################
> 
> 
> ---
> Roberto Bouza 
> Middle Tier Administrator II
> Bayview Financial, L.P.
> 4425 Ponce de Leon Blvd, 2nd Floor
> Coral Gables, FL 33146
> Ph. 305-644-2550
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com

_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j




More information about the SNMP4J mailing list