Details
-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
3.0.19.Final
-
None
Description
Deploying app with following JAXRS endpoint
@Path("/test") public class MyTimeResource { private final LocalDateTime dateTime; @Inject public MyTimeResource(LocalDateTime dateTime){ this.dateTime = dateTime; }; }
is failing with following stack trace:
Caused by: java.lang.RuntimeException: RESTEASY003190: Could not find constructor for class: org.example.microprofile.MyTimeResource at org.jboss.resteasy.spi.metadata.ResourceBuilder.constructor(ResourceBuilder.java:692) at org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.registered(POJOResourceFactory.java:42) at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:208) at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:194) at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:180) at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:157) at org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:76) at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:409) at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:250) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:113) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117) at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103) at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:250) at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:133) at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:546) at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:517) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:559) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82) ... 6 more
Note that app contains beans.xml so the JAXRS resource should be really managed by CDI.
I think this type of constructor is simply skipped (because it doesn't declare any JAXRS annotation) in org.jboss.resteasy.util.PickConstructor#pickPerRequestConstructor and that's the cause basically. CDI injector factory is called after.
Attachments
Issue Links
- causes
-
WFLY-7371 JAXRS endpoint - CDI injection to constructor doesn't work
- Closed
- is related to
-
JBEAP-6604 JAXRS endpoint - CDI injection to constructor doesn't work
- Closed