cqframework / clinical_quality_language

Clinical Quality Language (CQL) is an HL7 specification for the expression of clinical knowledge that can be used within both the Clinical Decision Support (CDS) and Clinical Quality Measurement (CQM) domains. This repository contains complementary tooling in support of that specification.
https://confluence.hl7.org/display/CDS/Clinical+Quality+Language
Apache License 2.0
251 stars 121 forks source link

Compile ELM as JSON not working #1357

Closed richfirely closed 2 months ago

richfirely commented 2 months ago

It appears that since the upgrade to the 4.0 eclipse dependencies ~ cql version 3.4, the json compiling stopped working. Here is the stack:

Exception in thread "main" java.lang.RuntimeException: jakarta.xml.bind.PropertyException: name: eclipselink.media-type value: application/json
        at org.cqframework.cql.elm.serializing.jaxb.ElmJsonLibraryWriter.write(ElmJsonLibraryWriter.java:26)
        at org.cqframework.cql.cql2elm.CqlTranslator.convertToJson(CqlTranslator.java:208)
        at org.cqframework.cql.cql2elm.CqlTranslator.toJson(CqlTranslator.java:130)
        at org.cqframework.cql.cql2elm.CqlTranslator.toJson(CqlTranslator.java:141)
        at org.cqframework.cql.cql2elm.cli.Main.writeELM(Main.java:100)
        at org.cqframework.cql.cql2elm.cli.Main.main(Main.java:243)
Caused by: jakarta.xml.bind.PropertyException: name: eclipselink.media-type value: application/json
        at jakarta.xml.bind.helpers.AbstractMarshallerImpl.setProperty(AbstractMarshallerImpl.java:352)
        at org.glassfish.jaxb.runtime.v2.runtime.MarshallerImpl.setProperty(MarshallerImpl.java:492)
        at org.cqframework.cql.elm.serializing.jaxb.ElmJsonLibraryWriter.write(ElmJsonLibraryWriter.java:24)
        ... 5 more

I believe I narrowed this down to a newer implementation added org.eclipse.persistence.jaxb.XMLBindingContextFactory

The following is a workaround which might help identify the root of the issue java -Djakarta.xml.bind.JAXBContextFactory=org.eclipse.persistence.jaxb.XMLBindingContextFactory -classpath .... org.cqframework.cql.cql2elm.cli.Main

JPercival commented 2 months ago

Thanks for the report, looking at this today.

JPercival commented 2 months ago

@richfirely - Still adding tests, but you want to try this and see if it works for you?

https://github.com/cqframework/clinical_quality_language/pull/1358

richfirely commented 2 months ago

Sorry for the delay. Thanks! its working