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

Compile ELM as JSON not working #1357

Closed
richfirely opened this issue Apr 23, 2024 · 3 comments · Fixed by #1358
Closed

Compile ELM as JSON not working #1357

richfirely opened this issue Apr 23, 2024 · 3 comments · Fixed by #1358
Assignees

Comments

@richfirely
Copy link

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
Copy link
Contributor

Thanks for the report, looking at this today.

@JPercival
Copy link
Contributor

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

#1358

@richfirely
Copy link
Author

Sorry for the delay. Thanks! its working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants