Re: problem in collecting json with names starting with a number

"Roskens, Ronald" <[email protected]>
Newsgroups gmane.network.opennms.general
Message-ID <B6663E208B2DA14DBB3C6FABB9207F78ABCFB9E2@biusmb4>
That's a strange one. Can you provide more details, like your xml-datacollection config, and a sample json, as with that data you can create a junit test to debug this further.

Ron

From: onmstester onmstester [mailto:[email protected]]
Sent: Monday, January 29, 2018 10:50 PM
To: [email protected]
Subject: [opennms-discuss] problem in collecting json with names starting with a number

I've ran into a problem while trying to collect json metrics from elatstic API, it seems like that attribute having name starting with a numeric character cause commons-jxpath to throw exception:

org.opennms.netmgt.collection.api.CollectionException: Can't collect XML data because Invalid XPath: '1name'. Syntax error after: '1'
        at org.opennms.protocols.xml.collector.XmlCollector.collect(XmlCollector.java:170) ~[org.opennms.protocols.xml-16.0.0.jar:?]
        at org.opennms.netmgt.collectd.CollectionSpecification.collect(CollectionSpecification.java:274) ~[opennms-services-16.0.0.jar:?]
        at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:388) ~[opennms-services-16.0.0.jar:?]
        at org.opennms.netmgt.collectd.CollectableService.doRun(CollectableService.java:322) [opennms-services-16.0.0.jar:?]
        at org.opennms.netmgt.collectd.CollectableService.access$000(CollectableService.java:70) [opennms-services-16.0.0.jar:?]
        at org.opennms.netmgt.collectd.CollectableService$1.run(CollectableService.java:300) [opennms-services-16.0.0.jar:?]
        at org.opennms.core.logging.Logging.withPrefix(Logging.java:66) [org.opennms.core.logging-16.0.0.jar:?]
        at org.opennms.netmgt.collectd.CollectableService.run(CollectableService.java:296) [opennms-services-16.0.0.jar:?]
        at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:209) [opennms-services-16.0.0.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_45]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_45]
        at org.opennms.core.concurrent.LogPreservingThreadFactory$3.run(LogPreservingThreadFactory.java:124) [opennms-util-16.0.0.jar:?]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: org.opennms.netmgt.collection.api.CollectionException: Invalid XPath: '1name'. Syntax error after: '1'
        at org.opennms.protocols.xml.collector.AbstractXmlCollectionHandler.collect(AbstractXmlCollectionHandler.java:198) ~[org.opennms.protocols.xml-16.0.0.jar:?]
        at org.opennms.protocols.xml.collector.XmlCollector.collect(XmlCollector.java:168) ~[org.opennms.protocols.xml-16.0.0.jar:?]
        ... 12 more
Caused by: org.apache.commons.jxpath.JXPathInvalidSyntaxException: Invalid XPath: '1name'. Syntax error after: '1'
        at org.apache.commons.jxpath.ri.Parser.parseExpression(Parser.java:63) ~[commons-jxpath-1.3.jar:1.3]
        at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.compileExpression(JXPathContextReferenceImpl.java:249) ~[commons-jxpath-1.3.jar:1.3]
        at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:280) ~[commons-jxpath-1.3.jar:1.3]
        at org.opennms.protocols.json.collector.AbstractJsonCollectionHandler.fillCollectionSet(AbstractJsonCollectionHandler.java:100) ~[org.opennms.protocols.xml-16.0.0.jar:?]
        at org.opennms.protocols.json.collector.DefaultJsonCollectionHandler.fillCollectionSet(DefaultJsonCollectionHandler.java:54) ~[org.opennms.protocols.xml-16.0.0.jar:?]
        at org.opennms.protocols.xml.collector.AbstractXmlCollectionHandler.collect(AbstractXmlCollectionHandler.java:191) ~[org.opennms.protocols.xml-16.0.0.jar:?]
        at org.opennms.protocols.xml.collector.XmlCollector.collect(XmlCollector.java:168) ~[org.opennms.protocols.xml-16.0.0.jar:?]
        ... 12 more

I've checked newest version of opennms, but still got the same exception?


----------------------------------------------------------------------
This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-discuss mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.