Stream: hapi
Topic: registerInterceptor to GenericClient
Romina Blasini (Mar 24 2020 at 14:41):
Hello,
i'm currently working on an fhir client, which sould send json-data to a hapi-fhir server.
I have the following code:
... IGenericClient client = FhirContext.forR4().newRestfulGenericClient(this.url); client.registerInterceptor(new BasicAuthInterceptor(this.username, this.password)); ...
This worked perfectly fine, until i updated the hapi version. I could see, that somehow by updating between 3.7.0 and 3.8.0 the code isn't working anymore and i get the following Exception:
Caused by: java.lang.NoSuchMethodError: org.apache.commons.lang3.reflect.MethodUtils.getAnnotation(Ljava/lang/reflect/Method;Ljava/lang/Class;ZZ)Ljava/lang/annotation/Annotation;
at ca.uhn.fhir.interceptor.executor.InterceptorService.findAnnotation(InterceptorService.java:573)
at ca.uhn.fhir.interceptor.executor.InterceptorService.scanInterceptorForHookMethods(InterceptorService.java:554)
at ca.uhn.fhir.interceptor.executor.InterceptorService.scanInterceptorAndAddToInvokerMultimap(InterceptorService.java:522)
at ca.uhn.fhir.interceptor.executor.InterceptorService.registerInterceptor(InterceptorService.java:187)
at ca.uhn.fhir.rest.client.impl.BaseClient.registerInterceptor(BaseClient.java:473)
at org.miracum.sodareg.rest.FhirExporter.initializeClient(FhirExporter.java:85)
...
It's not only like that with the BasicAuthInterceptor, but with every other Interceptor I try to register.
Has anyone an idea why I get this Exception or where I can find further explanation?
Thanks!
James Agnew (Mar 24 2020 at 15:08):
That looks like you have an old version of commons-lang3 on your classpath. Make sure to do a clean-build, and check that you're not hardcoding an old version in your pom
Romina Blasini (Mar 24 2020 at 15:25):
Thank you so much. That worked! :tada:
Last updated: Apr 12 2022 at 19:14 UTC