Model importer can silently fail and report importSuccessful when given badly formed XML

Description

I've recently re-based to the latest OpenNMS stable (1.8 series) and was having with the model importer. Although the events seem to imply the import had started and succeeded new nodes where not being added. After enabling diagnostics on the importer and seeing nothing I saw that output.log was throwing up exceptions in the parsing.

The script I was using generate my model-importer file was based on the old 1.6 era and generated a bad header referencing example.org:

<this:model-import xmlns:this="http://www.example.org/model-import"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalLocation="http://www.example.org/model-import model-import.xsd"
date-stamp="2008-08-20T00:03:09"
foreign-source="vnms">

As result this was causing a failure when the file was loaded:

Caused by: org.opennms.netmgt.provision.persist.ForeignSourceRepositoryException: unable to import requisition resource URL [file:/export/csrc/opennms/opennms.git/broken-import.xml]; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.example.org/model-import", local:"model-import"). Expected elements are <{http://xmlns.opennms.org/xsd/config/model-import}asset>,<{http://xmlns.opennms.org/xsd/config/model-import}category>,<{http://xmlns.opennms.org/xsd/config/model-import}interface>,<{http://xmlns.opennms.org/xsd/config/model-import}model-import>,<{http://xmlns.opennms.org/xsd/config/model-import}monitored-service>,<{http://xmlns.opennms.org/xsd/config/model-import}node>

However I was still seeing importSuccessful events which seemed to imply there where no problems.

Environment

Operating System: Linux Platform: PC

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Benjamin Reed March 14, 2012 at 9:36 PM

fixed in 1.10 branch

Alejandro Galue September 19, 2011 at 8:25 AM

This is also true when you miss the attribute snmp-primary for any interface on the requisition.

Take a look at this (this is from customer support ticket 609 (OpenNMS 1.8.12), the solution was add snmp-primary to all interfaces):

2011-08-25 14:35:58,518 INFO [importExecutor-2] Phase$PhaseMethod$1: failed to invoke lifecycle instance java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.opennms.netmgt.provision.service.lifecycle.Phase$PhaseMethod.doInvoke(Phase.java:194) at org.opennms.netmgt.provision.service.lifecycle.Phase$PhaseMethod.access$100(Phase.java:160) at org.opennms.netmgt.provision.service.lifecycle.Phase$PhaseMethod$1.run(Phase.java:177) at org.opennms.core.tasks.SyncTask.run(SyncTask.java:92) at org.opennms.core.tasks.SyncTask$1.run(SyncTask.java:103) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.IllegalArgumentException: null is not a valid InterfaceSnmpPrimaryType at org.opennms.netmgt.config.modelimport.types.InterfaceSnmpPrimaryType.valueOf(InterfaceSnmpPrimaryType.java:167) at org.opennms.netmgt.provision.service.RequisitionAccountant.visitInterface(RequisitionAccountant.java:80) at org.opennms.netmgt.provision.persist.OnmsIpInterfaceRequisition.visit(OnmsIpInterfaceRequisition.java:79) at org.opennms.netmgt.provision.persist.OnmsNodeRequisition.visit(OnmsNodeRequisition.java:125) at org.opennms.netmgt.provision.persist.requisition.Requisition.visit(Requisition.java:306) at org.opennms.netmgt.provision.service.operations.ImportOperationsManager.auditNodes(ImportOperationsManager.java:295) at org.opennms.netmgt.provision.service.CoreImportActivities.auditNodes(CoreImportActivities.java:130) ... 23 more
Fixed

Details

Assignee

Reporter

Labels

Fix versions

Affects versions

Priority

PagerDuty

Created October 20, 2010 at 6:02 AM
Updated January 27, 2017 at 4:21 PM
Resolved March 14, 2012 at 9:36 PM

Flag notifications