WebNMS Developer Forums
Click on Join Now to Sign Up
I'm trying to do a simple SNMP get on a single OID following the example here:
http://www.webnms.com/snmp/help/snmpapi/snmpv2c/index.html
My code is identical to the tutorial with the addition of session.setCommunity("xxx"). I can see the SNMP request being built and the correct data being returned with a network analyser (Wireshark) when I execute the example.
When I launch the program, I get a timeout as per below:
I've intentionally hidden IP addresses, and masked the DATA contents.
Sent Type: GET. RequestID: 1 to "127.0.0.1:161".
Sent Time: Thu Aug 20 14:21:29:017 BST 2009
Length of SNMP DATA: 43
DATA
Timed out. No more retries to "127.0.0.1:161". RequestID: 1
Time: Thu Aug 20 14:21:34:020 BST 2009
Exception in thread "main" java.lang.NullPointerException
at com.xxx.xxx.xxx.snmpget.main(snmpget.java:23)
An equivalent snmpget from the command line works as intended.
Any idea's where I can start debugging?
Kind regards,
Gareth
Sorry, the url should read:
http://www.webnms.com/snmp/help/snmpapi/snmpv2c/tutorials/overview/lowlevelapi_tutorial.html
I'm also using eclipse, and java 1.5 on OSX if it helps.
If I package up my project as a jar, and run it on a Redhat host this works perfectly. I guess there's something up with my local copy of java / eclipse / osx or a combination thereof.
Self answered question.
I've changed my default JVM to the 1.6 version following the instructions linked below, and everything started working perfectly in my development environment.
Thanks for taking the time to look, hopefully someone else may find this useful.
http://blogs.sun.com/cmar/entry/java_1_6_finally_available
Kind regards,
Gareth