Hi @ibacher , @gcliff , @dkayiwa ,
I’ve added fhir2 module in my core module and openmrs started successfully after that.
However, while fetching data from the database through Criteria, it is throwing an exception.
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(xyz.class);
criteria.add(Restrictions.eq("requester", provider));
List<xyz> list = (List<xyz>) criteria.list();
return list;
The function criteria.list() is throwing this error -
org.module.core.xyzt_$$_jvst774_69 cannot be cast to javassist.util.proxy.Proxy
This error is coming only when I’m adding fhir2 module.
dkayiwa
(Daniel Kayiwa)
July 29, 2021, 7:02pm
2
This usually happens when you have two versions of Javassist on the classpath.
Is the module publicly available on GitHub for us to take a look?
ibacher
(Ian Bacher)
August 2, 2021, 4:28pm
3
May actually be the FHIR2 module… Looks like we’ve accidentally been bundling the version of Javassist from OMRS 2.0.5 due to some issues with deep dependency trees. I’m working on fixing that for the 1.2.2 release.
Hi @ibacher ,
Do you have any idea by when it’ll be fixed as this a major part of the project we’re working on ?
ibacher
(Ian Bacher)
August 3, 2021, 2:44pm
6
Well, version 1.2.2 of the FHIR2 module no longer bundles a version of Javassist so if that was the cause of your issue, you should be able to download and use that version (released yesterday).
chughrahul
(Rahul Chugh)
September 7, 2021, 10:21am
7
Hi @dkayiwa , @ibacher ,
I’ve added fhir2 1.2.2 module in my core module but after performing an operation, it is throwing this error - java.lang.NoClassDefFoundError: com/google/gson/JsonElement org.hl - Pastebin.com
I’m performing this operation - org.hl7.fhir.r4.model.Bundle bundle = (Bundle) parser.parse(“Validated Resource JSON”);
ibacher
(Ian Bacher)
September 7, 2021, 1:19pm
8
@chughrahul Could you provide, e.g., the source code for the module you’re working on? There isn’t much to go on here.
chughrahul
(Rahul Chugh)
September 7, 2021, 1:56pm
9
Hi @ibacher ,
Here is the snippet of the source code for the module.
The line bundle = (Bundle) parser.parse(healthInfo); is throwing this error.
Also the json healthInfo is validated using fhir r4 validator.
ibacher
(Ian Bacher)
September 7, 2021, 2:15pm
10
Use HAPI’s FhirContext
to get a JSON parser rather than SimpleContextWorker
. You can even get one from the Spring context, e.g.,
@Autowired
@Qualifier("forR4")
private FhirContext fhirContext;
//...
fhirContext.newJsonParser().parseResource(Bundle.class, healthInfo);
Or you can bundle the appropriate version of GSON in your own module.
chughrahul
(Rahul Chugh)
September 7, 2021, 2:29pm
11
@ibacher Is there any other method other than importing the ca.uhn.fhir.context.FhirContext because I tried it but it throws error due to clash between ca.uhn.fhir & org.hl7.fhir
(Need FHIR2 encounter create and update calls - #15 by ibacher )
I used SimpleContextWorker in the place of FhirContext due to these reasons.
ibacher
(Ian Bacher)
September 7, 2021, 2:36pm
12
The other method is:
What error does it throw? What clash is there? Do you have a concrete example of something that fails?
chughrahul
(Rahul Chugh)
September 7, 2021, 3:26pm
13
Thank you for your support.
It is resolved by using the ca.uhn.fhir and no error is coming now