Open yasmin-aumeeruddy opened 2 years ago
Information added by Yasmin: Hi Jim If I were to remove this method: https://github.com/yasmin-aumeeruddy/open-liberty/blob/integration/dev/io.openlibe[…]roprofile/telemetry/internal/rest/TelemetryContainerFilter.java and run a server with the feature activated, I get this error when starting the server:
[INFO] [AUDIT ] CWWKF0011I: The system server is ready to run a smarter planet. The system server started in 9.670 seconds.
[INFO] [ERROR ] SRVE0271E: Uncaught init() exception created by servlet [io.openliberty.guides.system.SystemApplication] in application [guide-microprofile-opentracing-jaeger-system]: java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Constructor.getDeclaringClass()" because "constructor" is null
[INFO] at org.jboss.resteasy.cdi.CdiInjectorFactory.createConstructor(CdiInjectorFactory.java:92)
[INFO] at [internal classes]
[INFO]
[INFO] [ERROR ] SRVE0276E: Error while initializing Servlet [io.openliberty.guides.system.SystemApplication]: jakarta.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
[INFO] at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:368)
[INFO] at [internal classes]
[INFO] Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Constructor.getDeclaringClass()" because "constructor" is null
[INFO] at org.jboss.resteasy.cdi.CdiInjectorFactory.createConstructor(CdiInjectorFactory.java:92)
[INFO] ... 1 more
TelemetryContainerFilter.java public TelemetryContainerFilter() { TelemetryContainerFilter.java public TelemetryContainerFilter() {
https://quarkus.io/guides/cdi-reference#simplified-constructor-injection (edited) quarkus.ioquarkus.io Contexts and Dependency Injection Quarkus: Supersonic Subatomic Java (194 kB) https://quarkus.io/guides/cdi-reference#simplified-constructor-injection
(https://ibm-cloud.slack.com/archives/C03UD4UT6R4/p1661166020310839) After doing some digging, it seems to me that no-arg constructor is required but the spec says otherwise?
Information from Ben: Hi Jim. To summarize the issue we worked on the other day. You will see that this class has two constructors, one with and one without arguments: https://github.com/yasmin-aumeeruddy/open-liberty/blob/integration/dev/io.openlibe[…]roprofile/telemetry/internal/rest/TelemetryContainerFilter.java I believe that what should happen is that the first constructor should be used to create a proxy object. Then when a method is called on the proxy object CDI will fetch the correct bean and forward the method on. If the correct bean has not been created (e.g. it's the first call to a request scoped bean in this request) then the constructor annotated @Inject should be invoked, with CDI injecting the parameters. However when resteasy is on the thread the no-args constructor is used both to create the proxy and to create the actual bean. This is a bug that can be worked around but it would be cleaner if we could fix it. TelemetryContainerFilter.java public TelemetryContainerFilter() { https://github.com/[yasmin-aumeeruddy/open-liberty](https://github.com/yasmin-aumeeruddy/open-liberty)|yasmin-aumeeruddy/open-libertyyasmin-aumeeruddy/open-liberty | Added by a bot 6:14
jaeger-system]: java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Constructor.getDeclaringClass()" because "constructor" is null
at org.jboss.resteasy.cdi.CdiInjectorFactory.createConstructor(CdiInjectorFactory.java:92)
at io.openliberty.org.jboss.resteasy.common.cdi.LibertyFallbackInjectorFactory.createConstructor(LibertyFallbackInjectorFactory.java:67)
at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.injectedInstance(ResteasyProviderFactoryImpl.java:1398)
Record of problem for @jim-krueger See redhat issue here: https://issues.redhat.com/browse/RESTEASY-1538