[SNMP4J] IOException in DefaultUDPTransportMapping
Frank Fock
fock at agentpp.com
Fri Dec 19 17:29:28 CET 2008
Hi Shenaz,
You cannot report that error back, because
when you cannot decode the response (because
of an BER encoding error), you cannot match
the response with the request. Game over ;-)
Regards,
Frank
shenaz.assu at wipro.com wrote:
> Hi All,
>
> I'm facing an issue with SNMP GET. While sending the PDU to the SNMP agent with public ResponseEvent send(PDU pdu, Target target, TransportMapping transport) throws IOException method, i'm getting the following exception.
>
> java.io.IOException: Length greater than 32bit are not supported for integers: at position 49
> at org.snmp4j.asn1.BER.decodeInteger(BER.java:627)
> at org.snmp4j.smi.Integer32.decodeBER(Integer32.java:62)
> at org.snmp4j.smi.Variable.createFromBER(Variable.java:170)
> at org.snmp4j.smi.VariableBinding.decodeBER(VariableBinding.java:164)
> at org.snmp4j.PDUv1.decodeBER(PDUv1.java:169)
> at org.snmp4j.mp.MPv1.prepareDataElements(MPv1.java:170)
> at org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl.java:241)
> at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:313)
> at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:276)
> at org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:81)
> at org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:282)
>
> From this what I've understood is that, the SNMP agent is returning a value larger than integer for the attribute that is expected to return an integer value. This IOException is caught and logged in DefaultUdpTransportMapping. So in my application I'll get ResponseEvent with a null PDU and i'll throw an SnmpTimeOutError as the response is null.
>
> The problem is that I do not want to show the error as an SnmpTimeOut. I want to show the exact reason in my application. So I tried modifying the code and I threw a RunTimeException from the MessageDispatcherImpl after catching the IOException. Then I got the below log
>
> Exception in thread "DefaultUDPTransportMapping_192.168.234.72/0" java.lang.RuntimeException: Length greater than 32bit are not supported for integers: at position 49
> at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:324)
> at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:276)
> at org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:81)
> at org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:282)
>
> My requirement is that if i get an IOException like above I want to throw that exception and catch it in my code so that i can give a clearer message. Is it possible to do that? Can anyone of you help me out with this? Its really urgent.
>
> Thanks a lot!!
>
> Best regards
> Shenaz
>
>
> Please do not print this email unless it is absolutely necessary.
>
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
>
> www.wipro.com
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
More information about the SNMP4J
mailing list