0

We are invoking the HAPI REST API to validate the resource. Internal HAPI uses ph-schematron jar file to validate the same.

If we are invoking the API in simple java class by using the main method, it works with no issue. But we we execute exactly same code in framework of osgi, then it gives the below error.

3:13:00.379 DEBUG [bwEngThread:In-Memory Process Worker-8] c.p.commons.lang.ServiceLoaderUtils - Trying to load all SPI implementations of interface com.phloc.commons.hash.IHashCodeImplementationRegistrarSPI
13:13:00.380 DEBUG [bwEngThread:In-Memory Process Worker-8] c.p.commons.lang.ServiceLoaderUtils - Finished loading all SPI implementations of interface com.phloc.commons.hash.IHashCodeImplementationRegistrarSPI --> returning 0 instances
13:13:00.416 DEBUG [bwEngThread:In-Memory Process Worker-8] c.p.c.h.HashCodeImplementationRegistry - Found no hashCode implementation for class java.lang.String
13:13:00.521 WARN  [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [warn] Transformation warning (bundleresource://237.fwk27319466:25/schematron/20100414-xslt2/iso_schematron_skeleton_for_saxon.xsl: line 572: Attribute 'version' outside of element.)
13:13:00.521 WARN  [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [warn] Transformation warning (bundleresource://237.fwk27319466:25/schematron/20100414-xslt2/iso_schematron_skeleton_for_saxon.xsl: line 596: Attribute 'version' outside of element.)
13:13:00.522 WARN  [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [warn] Transformation warning (bundleresource://237.fwk27319466:25/schematron/20100414-xslt2/iso_schematron_skeleton_for_saxon.xsl: line 615: Attribute 'version' outside of element.)
13:13:01.768 ERROR [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [error] Transformation error (Syntax error in 'not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))'.)
13:13:01.769 ERROR [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [error] Transformation error (Error parsing XPath expression 'not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))'.)
13:13:01.769 ERROR [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [error] Transformation error (Required attribute 'test' is missing.)
13:13:01.769 ERROR [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [error] Transformation error (Syntax error in 'not(descendant-or-self::*/@*[not(name(.)=('abbr', 'accesskey', 'align', 'alt', 'axis', 'bgcolor', 'border', 'cellhalign', 'cellpadding', 'cellspacing', 'cellvalign', 'char', 'charoff', 'charset', 'cite', 'class', 'colspan', 'compact', 'coords', 'dir', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 'lang', 'longdesc', 'name', 'nowrap', 'rel', 'rev', 'rowspan', 'rules', 'scope', 'shape', 'span', 'src', 'start', 'style', 'summary', 'tabindex', 'title', 'type', 'valign', 'value', 'vspace', 'width'))])'.)
13:13:01.770 ERROR [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [error] Transformation error (Syntax error in 'not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])'.)
13:13:01.771 ERROR [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.LoggingTransformErrorListener - [fatal_error] Transformation fatal error (Syntax error in 'not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])'.)
13:13:01.800 ERROR [bwEngThread:In-Memory Process Worker-8] c.p.c.x.t.XMLTransformerFactory - Failed to parse javax.xml.transform.dom.DOMSource@522e178f
javax.xml.transform.TransformerConfigurationException: Syntax error in 'not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])'.
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:1020) ~[na:1.8.0_121]
    at com.phloc.commons.xml.transform.XMLTransformerFactory.newTemplates(XMLTransformerFactory.java:265) [phloc-commons-4.3.3.jar:4.3.3]
    at com.phloc.commons.xml.transform.XMLTransformerFactory.newTemplates(XMLTransformerFactory.java:226) [phloc-commons-4.3.3.jar:4.3.3]
    at com.phloc.schematron.xslt.SchematronProviderXSLTFromSCH.<init>(SchematronProviderXSLTFromSCH.java:177) [phloc-schematron-2.7.1.jar:2.7.1]
    at com.phloc.schematron.xslt.SchematronResourceSCHCache.createSchematronXSLTProvider(SchematronResourceSCHCache.java:115) [phloc-schematron-2.7.1.jar:2.7.1]
    at com.phloc.schematron.xslt.SchematronResourceSCHCache.getSchematronXSLTProvider(SchematronResourceSCHCache.java:192) [phloc-schematron-2.7.1.jar:2.7.1]
    at com.phloc.schematron.xslt.SchematronResourceSCH.<init>(SchematronResourceSCH.java:181) [phloc-schematron-2.7.1.jar:2.7.1]
    at com.phloc.schematron.xslt.SchematronResourceSCH.<init>(SchematronResourceSCH.java:139) [phloc-schematron-2.7.1.jar:2.7.1]
    at com.phloc.schematron.xslt.SchematronResourceSCH.<init>(SchematronResourceSCH.java:49) [phloc-schematron-2.7.1.jar:2.7.1]
    at com.phloc.schematron.xslt.SchematronResourceSCH.fromClassPath(SchematronResourceSCH.java:202) [phloc-schematron-2.7.1.jar:2.7.1]
    at ca.uhn.fhir.validation.schematron.SchematronBaseValidator.getSchematronAndCache(SchematronBaseValidator.java:147) [hapi-fhir-base-3.3.0.jar:na]
    at ca.uhn.fhir.validation.schematron.SchematronBaseValidator.getSchematron(SchematronBaseValidator.java:125) [hapi-fhir-base-3.3.0.jar:na]
    at ca.uhn.fhir.validation.schematron.SchematronBaseValidator.validateResource(SchematronBaseValidator.java:70) [hapi-fhir-base-3.3.0.jar:na]
    at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:231) [hapi-fhir-base-3.3.0.jar:na]
Hrushi
  • 163
  • 1
  • 10
  • 1
    Some of the XPath expressions the error messages show are using XPath 2 syntax, also the name "xslt2/iso_schematron_skeleton_for_saxon.xsl" of the XSLT you use clearly suggests it is meant for an XSLT 2 processor like Saxon 9 while your error messages citing "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl" suggest you are trying to run the stylesheet with the XSLT 1 processor the Java JRE comes with. So try to put Saxon 9 on the classpath. – Martin Honnen Aug 02 '18 at 07:56
  • Saxon-HE-9.5.1-5.jar is already in classpath – Hrushi Aug 02 '18 at 11:46
  • 1
    Well you're definitely running Xalan rather than Saxon. Try setting the system property `jaxp.debug=1` for diagnostics on the JAXP loading process. – Michael Kay Aug 03 '18 at 20:36
  • @MichaelKay, Yes, you are correct, we can see "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl" is getting preference while executing the code. My question is- we do have saxon-HE-9.5 jar in class path as well, but its not taking. What we should do here, any suggestion? Just FYI our code is in OSGI bundle. – Hrushi Aug 07 '18 at 14:24
  • @Hrushi Sorry, I have no experience in using the JAXP loading mechanism in conjunction with OSGi. – Michael Kay Aug 07 '18 at 17:19

0 Answers0