1 Apr 2009 15:11
NullPointerException while resending a GET request
Dear Frank,
I am using snmp4j version 1.9.3d for executing synchronous snmp GET requests.
My application has many threads, but each thread uses its own org.snmp4j.Snmp instance.
Sometimes I get the following exception:
java.lang.NullPointerException
at org.snmp4j.Snmp$PendingRequest.pduHandleAssigned(Unknown Source)
at org.snmp4j.MessageDispatcherImpl.sendPdu(Unknown Source)
at org.snmp4j.Snmp.sendMessage(Unknown Source)
at org.snmp4j.Snmp$PendingRequest.run(Unknown Source)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Exception in thread "Timer-4877612" java.lang.NullPointerException
at org.snmp4j.Snmp$PendingRequest.pduHandleAssigned(Unknown Source)
at org.snmp4j.MessageDispatcherImpl.sendPdu(Unknown Source)
at org.snmp4j.Snmp.sendMessage(Unknown Source)
at org.snmp4j.Snmp$PendingRequest.run(Unknown Source)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
After rebuilding SNMP4J.jar with debug information I saw that the problem was at line 1449 of Snmp.java file:
long delay = timeoutModel.getRetryTimeout(target.getRetries() -
retryCount,
target.getRetries(),
target.getTimeout());
That means the target object was null while trying to retransmit the request.
That can happen only for two reasons: a) PendingRequest of the retry action created
(Continue reading)
RSS Feed