[SNMP4J] Exception in heartbeat MIB when re-starting agent

Arnoud Zwemmer arnoud.zwemmer at avinity.net
Thu Nov 2 14:56:42 CET 2006


Hi Frank, 
 
Just downloaded the SNMP4J-Agent code. Looks like a great project,
compliments. After compiling and running, it worked out-of-the-box,
except for one thing in the Heartbeat MIB configuration files. Probably
an easy fix, but wanted to let you know the OOB-behaviour.
 
I initially ran the agent without .cfg files (on WinXP, JDK 1.5). When I
Ctrl-C it, the agent writes the .cfg files, saying:
 
15602 [Thread-0] DEBUG org.snmp4j.agent.io.MOServerPersistence  - Trying
to write MIB data for all contexts
15602 [Thread-0] DEBUG org.snmp4j.agent.io.MOServerPersistence  -
Writing 43 context independent managed objects
15642 [Thread-0] DEBUG org.snmp4j.agent.io.MOServerPersistence  - Trying
to write MIB data for context ' '
 
Now, when re-starting the agent it gives an exception when initializing
the heartbeat MIB from the config files (see below). Interestingly, this
exception does _not_ occur when I use a MIB browser to walk the entire
MIB after the first initialization (before Ctrl-C-ing and restarting
it).
 
The exception is this:
[...]
1312 [main] DEBUG org.snmp4j.agent.io.MOServerPersistence  - Looking up
object 1.3.6.1.4.1.4976.10.1.1.2.1.2.1.1
1312 [main] DEBUG org.snmp4j.agent.io.MOServerPersistence  - Loading
data for object 1.3.6.1.4.1.4976.10.1.1.2.1.2.1.1
1312 [main] DEBUG org.snmp4j.agent.io.MOServerPersistence  - Looking up
object 1.3.6.1.4.1.4976.10.1.1.42.2.1.1.0
1312 [main] DEBUG org.snmp4j.agent.io.MOServerPersistence  - Loading
data for object 1.3.6.1.4.1.4976.10.1.1.42.2.1.1.0
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0

        at org.snmp4j.smi.OctetString.get(OctetString.java:177)
        at
org.snmp4j.agent.mo.snmp.DateAndTime.makeCalendar(DateAndTime.java:137)
        at
org.snmp4j.agent.mo.snmp4j.example.Snmp4jHeartbeatMib$Snmp4jAgentHBRefTi
me.setValue(Snmp4jHeartbeatMib.java:361)
        at org.snmp4j.agent.mo.MOScalar.load(MOScalar.java:305)
        at
org.snmp4j.agent.io.MOServerPersistence.readData(MOServerPersistence.jav
a:128)
        at
org.snmp4j.agent.io.MOServerPersistence.loadData(MOServerPersistence.jav
a:80)
        at org.snmp4j.agent.BaseAgent.loadConfig(BaseAgent.java:263)
        at org.snmp4j.agent.BaseAgent.loadConfig(BaseAgent.java:236)
        at snmpagent.Main.main(Main.java:41)
 
Thanks, 
 
Arnoud.
 



More information about the SNMP4J mailing list