Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@HeaderParam annotation not detected on interface in external JAR #34408

Closed
wansors opened this issue Jun 29, 2023 · 5 comments
Closed

@HeaderParam annotation not detected on interface in external JAR #34408

wansors opened this issue Jun 29, 2023 · 5 comments
Labels
kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@wansors
Copy link

wansors commented Jun 29, 2023

Describe the bug

The following was working in Quarkus 2.X and fails in 3.X

When an Interface defined in external JAR with Jandex

@Path("email")
public interface EmailSenderMicroService {

        @POST
    @Path("/send")
    @Produces(MediaType.APPLICATION_JSON)
    public Response sendEmail(MailRequestJsonDto request, @HeaderParam(value = "Authorization") final String accessToken);

}

And the implementation is implemented like this:

    @Override
    @POST
    @Path("/send")
    public Response sendEmail(final MailRequestJsonDto request, final String accessToken) {
	//...
    }

Calling the service gives the following error:

java.io.IOException: Stream is closed
	at io.quarkus.vertx.http.runtime.VertxInputStream.read(VertxInputStream.java:78)
	at org.jboss.resteasy.plugins.providers.ProviderHelper.readString(ProviderHelper.java:68)
	at org.jboss.resteasy.plugins.providers.StringTextStar.readFrom(StringTextStar.java:44)
	at org.jboss.resteasy.plugins.providers.StringTextStar.readFrom(StringTextStar.java:28)
	at org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:99)
	at org.jboss.resteasy.core.interception.jaxrs.ServerReaderInterceptorContext.readFrom(ServerReaderInterceptorContext.java:60)
	at org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:81)
	at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:192)
	at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:87)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:116)
	at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:560)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:452)
	at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:413)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:356)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:70)
	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:576)
	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 java.base/java.lang.Thread.run(Thread.java:833)

Expected behavior

To automatically detect @HeaderParam from the interface and not fail if @HeaderParam is not added on the override method.

Actual behavior

It fails on Quarkus 3.X

How to Reproduce?

Create a dependency with the interface and Jandex index with a @HeaderParam parameter.
Add this dependency to main project.
Call the service witch has the @HeaderParam

Output of uname -a or ver

6.2.0-20-generic #20-Ubuntu SMP PREEMPT_DYNAMIC

Output of java -version

openjdk 17.0.7 2023-04-18

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.1.2.Final

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

Apache Maven 3.8.1

Additional information

No response

@wansors wansors added the kind/bug Something isn't working label Jun 29, 2023
@geoand
Copy link
Contributor

geoand commented Jun 29, 2023

Have you indexed the dependency in one of the methods described here?

@geoand geoand added triage/needs-feedback We are waiting for feedback. and removed triage/needs-triage labels Jun 29, 2023
@wansors
Copy link
Author

wansors commented Jun 29, 2023

Yes,
I tried with beans.xml, Yandex, and using quarkus.index-dependency, none of them work.

In Quarkus 2.X code was working, it fail after migrating to Jakarta

@geoand
Copy link
Contributor

geoand commented Jun 29, 2023

In that case, please attach a sample application that exhibits the problematic behavior

@geoand geoand added triage/needs-reproducer We are waiting for a reproducer. and removed triage/needs-feedback We are waiting for feedback. labels Jun 29, 2023
@wansors
Copy link
Author

wansors commented Jun 30, 2023

Sorry, I was recreating the problem in a new project and I discovered the problem.
It works ok if the implementation class does not replace any annotation. If on the implementation class I add any annotation, all of the interface annotation are ignored. For example:
@Override @POST @Path("/echo") public Response echo(final RequestJson body, final String header) { return Response.accepted(body.getBody() + "-" + header).build(); }

I supose this is normal. Sorry guys.

@geoand
Copy link
Contributor

geoand commented Jun 30, 2023

Thanks for the update

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Jun 30, 2023
@geoand geoand added triage/invalid This doesn't seem right and removed triage/needs-reproducer We are waiting for a reproducer. labels Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants