Stream: hapi
Topic: exception during $validate
Job Schipper (Sep 15 2020 at 10:04):
Hi,
Im running the official HAPI JPA server v5.0.0 from docker hub.
While validating a Patient resource against a profile I get the following error:
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Failed to call access method: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [ {
"severity": "error",
"code": "processing",
"diagnostics": "Failed to call access method: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"
} ]
}
The logs show the following stack trace:
2020-09-15 09:48:40.979 [http-nio-8080-exec-4] ERROR c.u.f.r.s.i.ExceptionHandlingInterceptor [ExceptionHandlingInterceptor.java:140] Failure during REST processing
ca.uhn.fhir.rest.server.exceptions.InternalErrorException: Failed to call access method: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at ca.uhn.fhir.rest.server.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:250)
at ca.uhn.fhir.rest.server.method.OperationMethodBinding.invokeServer(OperationMethodBinding.java:329)
at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.doInvokeServer(BaseResourceReturningMethodBinding.java:247)
at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.invokeServer(BaseResourceReturningMethodBinding.java:384)
at ca.uhn.fhir.rest.server.method.OperationMethodBinding.invokeServer(OperationMethodBinding.java:304)
at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:1029)
at ca.uhn.fhir.rest.server.RestfulServer.doGet(RestfulServer.java:363)
at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1722)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1839)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at ca.uhn.fhir.rest.server.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:245)
... 30 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:458)
at org.hl7.fhir.dstu3.conformance.ProfileUtilities.updateFromDefinition(ProfileUtilities.java:1186)
at org.hl7.fhir.dstu3.conformance.ProfileUtilities.processPaths(ProfileUtilities.java:760)
at org.hl7.fhir.dstu3.conformance.ProfileUtilities.generateSnapshot(ProfileUtilities.java:389)
at org.hl7.fhir.dstu3.conformance.ProfileUtilities.processPaths(ProfileUtilities.java:518)
at org.hl7.fhir.dstu3.conformance.ProfileUtilities.generateSnapshot(ProfileUtilities.java:389)
at org.hl7.fhir.common.hapi.validation.support.SnapshotGeneratingValidationSupport.generateSnapshot(SnapshotGeneratingValidationSupport.java:54)
at org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain.generateSnapshot(ValidationSupportChain.java:65)
at org.hl7.fhir.common.hapi.validation.support.BaseValidationSupportWrapper.generateSnapshot(BaseValidationSupportWrapper.java:93)
at org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContextWrapper.lambda$new$0(VersionSpecificWorkerContextWrapper.java:91)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.lambda$new$0(BoundedLocalCache.java:3670)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2337)
at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2335)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2318)
at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:111)
at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:66)
at org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContextWrapper.fetchResource(VersionSpecificWorkerContextWrapper.java:290)
at org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContextWrapper.fetchRawProfile(VersionSpecificWorkerContextWrapper.java:371)
at org.hl7.fhir.common.hapi.validation.validator.ValidatorWrapper.fetchAndAddProfile(ValidatorWrapper.java:195)
at org.hl7.fhir.common.hapi.validation.validator.ValidatorWrapper.validate(ValidatorWrapper.java:135)
at org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator.validate(FhirInstanceValidator.java:301)
at org.hl7.fhir.common.hapi.validation.validator.BaseValidatorBridge.doValidate(BaseValidatorBridge.java:22)
at org.hl7.fhir.common.hapi.validation.validator.BaseValidatorBridge.validateResource(BaseValidatorBridge.java:45)
at org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator.validateResource(FhirInstanceValidator.java:30)
at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:221)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao.validate(BaseHapiFhirResourceDao.java:1429)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy202.validate(Unknown Source)
at ca.uhn.fhir.jpa.provider.dstu3.JpaResourceProviderDstu3.validate(JpaResourceProviderDstu3.java:196)
... 35 common frames omitted
It could be that this has something to do with the profile i'm validating against, however, I can't tell from the error if this is the case, and if so, what the actual problem is. Any idea?
Thanks!
Job Schipper (Sep 21 2020 at 11:06):
I created a github issue with reproduction steps: https://github.com/jamesagnew/hapi-fhir/issues/2095
Job Schipper (Sep 28 2020 at 08:26):
@James Agnew It looks like the error is caused within the org.hl7.fhir.dstu3.conformance.ProfileUtilities dependency. I want to see if i can debug this, but im using docker to run hapi. Can you show me how i can load a modified version of that dependency into the docker build process from https://github.com/hapifhir/hapi-fhir-jpaserver-starter ? I don't have much experience with java and the mvn package manager
Job Schipper (Sep 28 2020 at 15:20):
@James Agnew i just tried this with the :latest new tag from https://hub.docker.com/r/hapiproject/hapi and it looks like this issue has been fixed. (however, tag v5.1.0 is still broken as reported in https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/129)
any way that current :latest be tagged with v5.1.1? would be great!
Last updated: Apr 12 2022 at 19:14 UTC