Other Errors

This section describes other errors that you may encounter when Horizon does not start as expected.

XML configuration errors

XML errors can occur when an XML file in the ${OPENNMS_HOME}/etc/ hierarchy contains errors that cause it not to be a well-formed XML document, or that lead to an invalid configuration according to the XML file’s schema.

Example XML error log
Mar 20 14:41:53 rhel9h.totusmel.com opennms[130123]: Starting OpenNMS:
Mar 20 14:41:53 rhel9h.totusmel.com opennms[130823]: ERROR: XML validation failed: /opt/opennms/etc/events/VMWare.events.xml
Mar 20 14:41:53 rhel9h.totusmel.com opennms[130823]:            run '/usr/bin/xmllint /opt/opennms/etc/events/VMWare.events.xml' for details
Mar 20 14:41:53 rhel9h.totusmel.com opennms[130123]: Validation failed on 1 XML files.  Exiting.
Mar 20 14:41:53 rhel9h.totusmel.com opennms[130123]: failed

If you run config-tester -a, the output shows that an error is generated immediately after the Drools Northbounder configuration is loaded:

11:05:42.570 [Main] INFO  org.opennms.core.xml.AbstractJaxbConfigDao - Loaded Config for Drools Northbounder in 6 ms
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.opennms.bootstrap.Bootstrap$4.run(Bootstrap.java:531)
    at java.base/java.lang.Thread.run(Thread.java:829)

You can use the xmllint tool to validate the XML files and more effectively identify the source of the error:

# xmllint --schema /var/opennms/xsds/eventconf.xsd /opt/opennms/etc/events/VMWare.events.xml --noout
/opt/opennms/etc/events/VMWare.events.xml:275: parser error : Opening and ending tag mismatch: logmsg line 273 and event
/opt/opennms/etc/events/VMWare.events.xml:276: parser error : Opening and ending tag mismatch: logmsg line 265 and events
/opt/opennms/etc/events/VMWare.events.xml:277: parser error : Premature end of data in tag event line 223

In this example, an unmatched tag in /opt/opennms/etc/events/VMWare.events.xml is the source of the issue:

265      <logmsg dest="logndisplay">&lt;p>
266            vpxdTrap trap received
267            vpxdTrapType=%parm[#1]%
268            vpxdHostName=%parm[#2]%
269            vpxdVMName=%parm[#3]%
270            vpxdNewStatus=%parm[#4]%
271            vpxdOldStatus=%parm[#5]%
272            vpxdObjValue=%parm[#6]%&lt;/p>
273      <logmsg>

This error can be fixed by updating line 273 to </logmsg>. If you run xmllint again, the file should validate properly:

# xmllint --schema /var/opennms/xsds/eventconf.xsd /opt/opennms/etc/events/VMWare.events.xml --noout
/opt/opennms/etc/events/VMWare.events.xml validates

Horizon should now start properly.

You can run xmllint on all files in ${OPENNMS_HOME}/etc/events using this command:

for x in ${OPENNMS_HOME}/etc/events/*;do xmllint --schema ${OPENNMS_HOME}/share/xsds/eventconf.xsd $x --noout;done
xmllint can help pinpoint errors in XML syntax and in content that violates the schema (using the --schema flag). More subtle errors may cause problems, however, even if the output indicates that all files are valid. The config-tester command is even more exhaustive, but it may not catch all errors that break startup.