[SNMP4J] Address type udp unknown

Brian_Teravskis at cargill.com Brian_Teravskis at cargill.com
Tue Jul 20 18:50:41 CEST 2004


Hello,

I'm using the SNMP4J library in a multithreaded program that polls
various network devices for ARP cache information. Occasionally I get
the following error on one or more of my threads:

2004-07-20 11:32:48,784 ARPSlavePoller(42): Fatal error in polling,
thread[1] terminating. 
java.lang.IllegalArgumentException: Address type udp unknown
      at org.snmp4j.smi.GenericAddress.parse(GenericAddress.java:157)
      at com.cargill.rap.MySnmp.connect(MySnmp.java:66)
      at com.cargill.rap.MACData.fetchMACsFromRouter(MACData.java:28)
      at
com.cargill.rap.ARPSlavePoller.startPolling(ARPSlavePoller.java:58)
      at com.cargill.rap.ARPSlavePoller.run(ARPSlavePoller.java:40)
      at java.lang.Thread.run(Unknown Source)

I'm using version 1.0 of SNMP4J in a Windows base Java runtime
enviroment running v 1.4.2_04. 

Here is the connect code I am using:

public void connect () {
  String genericAddressString = PROTOCOL+":"+address+":"+PORT;
  // System.out.println("SNMP Address String: "+genericAddressString);
  if((targetAddress = GenericAddress.parse(genericAddressString)) ==
null) {
    System.out.println("Error in SNMP Address String:
"+genericAddressString);
  } else {
    try {
      transport = new DefaultUdpTransportMapping();
      snmp = new Snmp(transport);

      CommunityTarget cTarget = new CommunityTarget();
      cTarget.setCommunity(new OctetString(community));
      target = cTarget;

      target.setVersion(version);
      target.setRetries(retries);
      target.setTimeout(socketTimeout);
      target.setAddress(targetAddress);

      transport.listen();
      } catch (IOException ioe) {
      System.err.println("Error while trying to 'connect': " +
          targetAddress.toString() + "\n" +
        ioe.getMessage());
        ioe.printStackTrace();
      }
    }
  }

This does not bomb all of the time, but seems to be happening more and
more. Is there something I should be doing special in a multi-threaded
environment when I'm initializing the SNMP libraries?

Thank you,

Brian




More information about the SNMP4J mailing list