Hello,
I am seeing an issue with using CDI on Redhat JBoss EAP 7
with hapi-fhir 5.3.3.
The use case is
10:36:51,782 ERROR
[io.undertow.request] (default task-1) UT005023: Exception handling request to
/hapi-fhir-eap7/DiagnosticReport: javax.servlet.ServletException: Failed to
initialize FHIR Restful server
at ca.uhn.fhir.rest.server.RestfulServer.init(RestfulServer.java:1333)
…
Caused by: java.lang.NullPointerException
at
java.lang.Class.isAssignableFrom(Native Method)
at
ca.uhn.fhir.rest.server.method.MethodUtil.getResourceParameters(MethodUtil.java:91)
at
ca.uhn.fhir.rest.server.method.BaseMethodBinding.<init>(BaseMethodBinding.java:74)
…
A small reproduction project with full stack trace can be found here: https://github.com/mbw-ahc/hapi-fhir-eap7
I believe the following is going on
Redhat JBoss EAP 7.3 is using WELD 3.1 for CDI. According to
https://issues.redhat.com/browse/WELD-1539 and https://issues.redhat.com/browse/WELD-2423
the weld proxies will generate methods with raw types rather than generic
types. Therefore Set<Include> original
class will be just a Set in the proxy method.
This causes the exception in the hapi-fhir reflection code running against
the proxy instance.
The guidance from WELD-1539
is to “Therefore, integrators are encouraged to detect client proxies and
subclasses and work around the problem via reflection. “
Although found in EAP 7.3, I expect this would be an issue
in all EAP 7 versions.
First found in hapi-fhir 5.1.0 but reproduced as well in hapi-fhir 5.3.3
Is there a way to have hapi-fhir work with these proxies?
Let me know if this is better handed as bug report.
Mark