Error reading ami-config.xml
Description
Acceptance / Success Criteria
Lucidchart Diagrams
Activity

Benjamin Reed January 12, 2015 at 11:55 AM
Fixed AmiPeerFactory to do better bounds-checking.

Craig Askings January 11, 2015 at 7:45 PM
I'm having the same issue when trying to send a notify via a agi call.
{{2015-01-12 00:29:50,820 ERROR [Thread-111654] o.o.n.n.ClassExecutor: Throwable received while sending message
java.lang.NullPointerException
at org.opennms.netmgt.config.ami.Definition.getRetry(Definition.java:448) ~[opennms-config-model-14.0.2.jar:?]
at org.opennms.netmgt.config.AmiPeerFactory.determineRetries(AmiPeerFactory.java:475) ~[opennms-config-14.0.2.jar:?]
at org.opennms.netmgt.config.AmiPeerFactory.setCommonAttributes(AmiPeerFactory.java:439) ~[opennms-config-14.0.2.jar:?]
at org.opennms.netmgt.config.AmiPeerFactory.setAmiAgentConfig(AmiPeerFactory.java:428) ~[opennms-config-14.0.2.jar:?]
at org.opennms.netmgt.config.AmiPeerFactory.getAgentConfig(AmiPeerFactory.java:387) ~[opennms-config-14.0.2.jar:?]
at org.opennms.netmgt.asterisk.utils.AsteriskOriginator.<init>(AsteriskOriginator.java:131) ~[opennms-asterisk-14.0.2.jar:?]
at org.opennms.netmgt.asterisk.utils.AsteriskOriginator.<init>(AsteriskOriginator.java:150) ~[opennms-asterisk-14.0.2.jar:?]
at org.opennms.netmgt.notifd.asterisk.AsteriskOriginateNotificationStrategy.buildOriginator(AsteriskOriginateNotificationStrategy.java:76) ~[opennms-asterisk-14.0.2.jar:?]
at org.opennms.netmgt.notifd.asterisk.AsteriskOriginateNotificationStrategy.send(AsteriskOriginateNotificationStrategy.java:67) ~[opennms-asterisk-14.0.2.jar:?]
at org.opennms.netmgt.notifd.ClassExecutor.execute(ClassExecutor.java:69) [opennms-services-14.0.2.jar:?]
at org.opennms.netmgt.notifd.NotificationTask.run(NotificationTask.java:269) [opennms-services-14.0.2.jar:?]
}}
After an upgrade from 1.12 to 14.0.2, the AsteriskSIPPeer poller does not work anymore. The reason for this is a null pointer exception, when getting the configuration from ami-config.xml using org.opennms.netmgt.config.AmiPeerFactory.getAgentConfig() (see poller.log below).
We use the default form of ami-config.xml:
<ami-config retry="2" timeout="1500"
username="opennms" password="XXX">
</ami-config>
poller.log
2014-12-16 11:30:43,776 ERROR [Poller-Thread-27-of-30] o.o.n.p.p.PollableServiceConfig: Unexpected exception while polling PollableService [PollableInterface [PollableNode [2408]:172.16.200.1]:SIP-Peer-uplink]. Marking service as DOWN
java.lang.NullPointerException
at org.opennms.netmgt.config.ami.Definition.getRetry(Definition.java:448) ~[opennms-config-model-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.config.AmiPeerFactory.determineRetries(AmiPeerFactory.java:475) ~[opennms-config-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.config.AmiPeerFactory.setCommonAttributes(AmiPeerFactory.java:439) ~[opennms-config-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.config.AmiPeerFactory.setAmiAgentConfig(AmiPeerFactory.java:428) ~[opennms-config-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.config.AmiPeerFactory.getAgentConfig(AmiPeerFactory.java:387) ~[opennms-config-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.asterisk.monitor.AsteriskSIPPeerMonitor.poll(AsteriskSIPPeerMonitor.java:135) ~[opennms-asterisk-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.poller.pollables.LatencyStoringServiceMonitorAdaptor.poll(LatencyStoringServiceMonitorAdaptor.java:111) ~[opennms-services-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.poller.pollables.PollableServiceConfig.poll(PollableServiceConfig.java:116) [opennms-services-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.poller.pollables.PollableService.poll(PollableService.java:189) [opennms-services-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.poller.pollables.PollableElement.poll(PollableElement.java:293) [opennms-services-14.0.2-SNAPSHOT.jar:?]
at org.opennms.netmgt.poller.pollables.PollableContainer$5.run(PollableContainer.java:319) [opennms-services-14.0.2-SNAPSHOT.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_71]