Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] JMC probe template validation error #238

Closed
andrewazores opened this issue Jun 20, 2023 · 0 comments · Fixed by #243
Closed

[Bug] JMC probe template validation error #238

andrewazores opened this issue Jun 20, 2023 · 0 comments · Fixed by #243
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@andrewazores
Copy link
Member

Using the following XML probe template definition, which I generated using the JMC wizard:

<jfragent>
    <config>
        <classprefix>__JFREvent</classprefix>
        <allowtostring>false</allowtostring>
        <allowconverter>false</allowconverter>
    </config>
    <events>
        <event id="io.cryostat.quarkus.demo.event1">
            <label>Cryostat Quarkus Demo Event 1</label>
            <class>jakarta.persistence.EntityManager</class>
            <stacktrace>true</stacktrace>
            <rethrow>true</rethrow>
            <location>WRAP</location>
            <method>
                <name>find</name>
                <descriptor>(Ljava/lang/Class;Ljava/lang/Object;)Ljava/lang/Object;</descriptor>
                <parameters>
                    <parameter index="0">
                        <name>klazz</name>
                        <contenttype>Class</contenttype>
                    </parameter>
                    <parameter index="1">
                        <name>key</name>
                        <contenttype>None</contenttype>
                    </parameter>
                </parameters>
            </method>
        </event>
    </events>
</jfragent>

I get the following stack trace when attempting to upload it to Cryostat on the Events view:

Jun 20, 2023 8:28:49 PM io.cryostat.core.log.Logger error
SEVERE: cvc-enumeration-valid: Value 'CLASS' is not facet-valid with respect to enumeration '[None, Bytes, Timestamp, Millis, Nanos, Ticks, Address, OSThread, JavaThread, StackTrace, Class, Percentage]'. It must be a value from the enumeration.
Jun 20, 2023 8:28:49 PM io.cryostat.core.log.Logger warn
WARNING: HTTP 400: cvc-enumeration-valid: Value 'CLASS' is not facet-valid with respect to enumeration '[None, Bytes, Timestamp, Millis, Nanos, Ticks, Address, OSThread, JavaThread, StackTrace, Class, Percentage]'. It must be a value from the enumeration.
io.vertx.ext.web.handler.HttpException: Bad Request
Caused by: io.cryostat.net.web.http.api.v2.ApiException: cvc-enumeration-valid: Value 'CLASS' is not facet-valid with respect to enumeration '[None, Bytes, Timestamp, Millis, Nanos, Ticks, Address, OSThread, JavaThread, StackTrace, Class, Percentage]'. It must be a value from the enumeration.
	at io.cryostat.net.web.http.api.v2.ProbeTemplateUploadHandler.handle(ProbeTemplateUploadHandler.java:158)
	at io.cryostat.net.web.http.api.v2.AbstractV2RequestHandler.handle(AbstractV2RequestHandler.java:108)
	at io.cryostat.net.web.http.api.v2.AbstractV2RequestHandler.handle(AbstractV2RequestHandler.java:71)
	at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
	at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
	at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
	at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
	at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: io.cryostat.core.agent.ProbeValidationException: cvc-enumeration-valid: Value 'CLASS' is not facet-valid with respect to enumeration '[None, Bytes, Timestamp, Millis, Nanos, Ticks, Address, OSThread, JavaThread, StackTrace, Class, Percentage]'. It must be a value from the enumeration.
	at io.cryostat.core.agent.ProbeValidator$ProbeValidatorErrorHandler.error(ProbeValidator.java:121)
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:138)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:512)
	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3600)
	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3437)
	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3347)
	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2373)
	at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:944)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1728)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2899)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.StreamValidatorHelper.validate(StreamValidatorHelper.java:178)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:115)
	at io.cryostat.core.agent.ProbeValidator.validate(ProbeValidator.java:89)
	at java.xml/javax.xml.validation.Validator.validate(Validator.java:124)
	at io.cryostat.core.agent.ProbeTemplate.deserialize(ProbeTemplate.java:98)
	at io.cryostat.core.agent.LocalProbeTemplateService.getTemplate(LocalProbeTemplateService.java:114)
	at io.cryostat.net.web.http.api.v2.ProbeTemplateUploadHandler.handle(ProbeTemplateUploadHandler.java:137)
	... 11 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 57; cvc-enumeration-valid: Value 'CLASS' is not facet-valid with respect to enumeration '[None, Bytes, Timestamp, Millis, Nanos, Ticks, Address, OSThread, JavaThread, StackTrace, Class, Percentage]'. It must be a value from the enumeration.
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:135)
	... 34 more
Jun 20, 2023 8:28:49 PM org.slf4j.impl.JDK14LoggerAdapter fillCallerData
WARNING: 10.89.1.31 - - [Tue, 20 Jun 2023 20:28:49 GMT] 16ms "POST /api/v2/probes/jmc-agent-probe.xml HTTP/1.1" 400 310 bytes "http://localhost:8181/events?agentTab=agent-template" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
Jun 20, 2023 8:28:50 PM org.slf4j.impl.JDK14LoggerAdapter fillCallerData
INFO: 0:0:0:0:0:0:0:1%0 - - [Tue, 20 Jun 2023 20:28:50 GMT] 0ms "GET /health/liveness HTTP/1.1" 204 0 bytes "-" "curl/7.61.1"

Removing the <parameters> element fixes the immediate problem and I can continue, but without being able to capture method parameters in the event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
No open projects
Status: Done
Status: Done
2 participants