Skip to content

JAX-RS subresource issue in Quarkus native build #37148

@DeMol-EE

Description

@DeMol-EE

Describe the bug

General architecture:

@Path("foo")
@RequestScoped
public class FooResource {

  @Path("{id}")
  public BarResource bar(@Context ResourceContext rc) {
        return rc.initResource(CDI.current()
                .select(BarResource.class)
                .get());
  }
}
@Dependent
@Unremovable
@RegisterForReflection
public class BarResource {

  @PathParam("id")
  String id;

  // some CDI @Inject dependencies omitted

  @GET
  public boolean get(@QueryParam("bar") Integer bar) {
    return true;
  }
}

When executing an HTTP GET for /foo/some?bar=5, we get the following exception:

Encountered an issue: org.jboss.resteasy.spi.InternalServerErrorException: RESTEASY003815: Subresource for target class has no qualifying annotations.: ...BarResource.class...
        at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:157)
	at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:131)
	at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:33)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:240)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
	at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:229)
	at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:82)
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:147)
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:93)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:582)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
	at [email protected]/java.lang.Thread.run(Thread.java:1583)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211)

Expected behavior

No exception, or detection of the issue at build time.

Actual behavior

Exception when trying to call endpoint specified in subresource

How to Reproduce?

See reproducer

Output of uname -a or ver

runtime provided by quarkus-micro-image:2.0

Output of java -version

jdk 21 used in the mandrel build image

Mandrel or GraalVM version (if different from Java)

built with quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21, released with quay.io/quarkus/quarkus-micro-image:2.0

Quarkus version or git rev

3.5.2

Build tool (ie. output of mvnw --version or gradlew --version)

mvn 3.9.5, via mvnw 3.2.0

Additional information

  • JAXRS extension: quarkus-resteasy-jackson
  • We added @RegisterForReflection after reading this, but to no avail
  • Getting subresources and CDI to work never went smoothly, it took some trial-and-error but the shenanigans with ResourceContext work.
  • this is a minimal Quarkus app with strictly quarkus extensions as dependencies

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions