Can't create FHIR Tasks with Bahmni Standard: Caused by: java.lang.NullPointerException

Hi all,

I’m working with Bahmni Standard, involving the following artefacts that are connected to the error I’m facing,

OpenMRS Core: 2.5.12

Event Module: 2.10.0

FHIR2: 2.3.0-SNAPSHOT

FHIR2 module extensions: 1.3.1

I don’t seem to be able to create a FHIR Task with the following error:

ERROR - ExceptionHandlingInterceptor.createOperationOutcome(141) |2025-01-30T09:33:57,012| Failure during REST processing
ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HAPI-0389: Failed to call access method: java.lang.NullPointerException
        at ca.uhn.fhir.rest.server.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:273) ~[hapi-fhir-server-5.7.9.jar:?]
        .
        ..
        at org.openmrs.module.fhir2.web.servlet.FhirRestServlet.service(FhirRestServlet.java:193) ~[fhir2.jar:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:583) ~[servlet-api.jar:?]
        at org.openmrs.module.web.ModuleServlet.service(ModuleServlet.java:71) ~[openmrs-web-2.5.12.jar:?]
        .
        ..
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor1356.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_372]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_372]
        at ca.uhn.fhir.rest.server.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:265) ~[hapi-fhir-server-5.7.9.jar:?]
        ... 73 more
Caused by: java.lang.NullPointerException
        at org.openmrs.event.api.db.hibernate.HibernateEventInterceptor.onSave(HibernateEventInterceptor.java:75) ~[event-api-2.10.0.jar:?]
        at org.openmrs.api.db.hibernate.ChainingInterceptor.onSave(ChainingInterceptor.java:101) ~[openmrs-api-2.5.12.jar:?]
        at org.hibernate.event.internal.AbstractSaveEventListener.substituteValuesIfNecessary(AbstractSaveEventListener.java:389) ~[hibernate-core-5.6.0.Final.jar:5.6.0.Final]
        .
        ..
        at org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:656) ~[hibernate-core-5.6.0.Final.jar:5.6.0.Final]
        at org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:649) ~[hibernate-core-5.6.0.Final.jar:5.6.0.Final]
        at org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:644) ~[hibernate-core-5.6.0.Final.jar:5.6.0.Final]
        at org.openmrs.module.fhir2.api.dao.impl.FhirTaskDaoImpl.createOrUpdate(FhirTaskDaoImpl.java:78) ~[fhir2-api-2.3.0-SNAPSHOT.jar:?]
        at org.openmrs.module.fhir2.api.dao.impl.FhirTaskDaoImpl.createOrUpdate(FhirTaskDaoImpl.java:36) ~[fhir2-api-2.3.0-SNAPSHOT.jar:?]
        at org.openmrs.module.fhir2.api.impl.BaseFhirService.create(BaseFhirService.java:101) ~[fhir2-api-2.3.0-SNAPSHOT.jar:?]
        .
        ..

Full log accessible here: https://pastebin.com/raw/eAsX2YNG

@ibacher, @angshuonline, @wyclif, @dkayiwa, @all, would any of you have seen this or have a solution to it?

cc @mksrom, @suruchi, @corneliouzbett

No idea off-hand. Unless things got called in a weird order I can’t really understand how the line in question could throw a NPE.

I think this might need stepping through in a debugger to figure out what’s wrong.

1 Like

I remember seeing something like this related to transactions. But trying to scratch my head to find out what exactly it was. :wink:

2 Likes