question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resteasy Reactive - Arraylist is an Invalid parameter typ

See original GitHub issue

Describe the bug

During the migration from Resteasy Classic to Resteasy Reactive of one of my applications, I got the stacktrace from below during compilation.

I investigated this problem a bit, and found following resource to be the culprit:

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello(@QueryParam("states") ArrayList<Integer> states)

Replacing the ArrayList with a simple java.util.List, the code compiles and I can call the resource. This worked flawlessly with ArrayList in Resteasy Classic.

Expected behavior

Either allow subtypes of the collection interfaces as parameter of rest resources, or document this required migration.

Actual behavior

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.13.0.CR1:build (default) on project rr-list-queryparam: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor#setupEndpoints threw an exception: java.lang.RuntimeException: java.lang.RuntimeException: Failed to process method org.acme.ReactiveGreetingResource#java.lang.String h
ello(java.util.ArrayList<java.lang.Integer> states)
[ERROR]         at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:238)
[ERROR]         at io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor.setupEndpoints(ResteasyReactiveProcessor.java:396)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.lang.RuntimeException: Failed to process method org.acme.ReactiveGreetingResource#java.lang.String hello(java.util.ArrayList<java.lang.Integer> states)
[ERROR]         at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:512)
[ERROR]         at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:285)
[ERROR]         at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:209)
[ERROR]         ... 11 more
[ERROR] Caused by: java.lang.RuntimeException: Invalid parameter type 'java.util.ArrayList<java.lang.Integer>' used on method method java.lang.String hello(java.util.ArrayList<java.lang.Integer> states) on class org.acme.ReactiveGreetingResource
[ERROR]         at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.extractParameterInfo(EndpointIndexer.java:899)
[ERROR]         at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:407)
[ERROR]         ... 13 more
[ERROR] -> [Help 1]

To Reproduce

Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).

Or attach an archive containing the reproducer to the issue.

Steps to reproduce the behavior:

  1. Download the reproducer: rr-list-queryparam.zip
  2. mvn clean install
  3. Exception from above happens
  4. Now replace quarkus-resteasy-reactive with quarkus-resteasy
  5. mvn clean install
  6. No exception

Environment (please complete the following information):

Output of uname -a or ver

MSYS_NT-10.0 NANB7NLNVP2 2.10.0(0.325/5/3) 2018-06-13 23:34 x86_64 Msys

Quarkus version or git rev

1.13.0.CR1

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

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: C:\eclipse\tools\apache-maven\bin.. Java version: 11.0.7, vendor: Azul Systems, Inc., runtime: C:\eclipse\tools\zulu11.39.15-ca-jdk11.0.7-win_x64 Default locale: de_DE, platform encoding: Cp1252 OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
FroMagecommented, Mar 23, 2021

https://quarkus.io/specs/jaxrs/2.1/index.html#resource_field only mentions List.

I’m not sure why it would be useful to force an implementation class for List such as ArrayList.

ATM we do inject with SingletonList, EmptyList or ArrayList, so it’s not even as if we always inject an ArrayList.

1reaction
geoandcommented, Mar 23, 2021

I say let’s leave things as they are for now. Switching to List is super easy for users and it’s probably best we don’t overcommit to such details that could perhaps could back to bite us in the future

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing REST Services with RESTEasy Reactive - Quarkus
This guide explains how to write REST Services with RESTEasy Reactive in ... See URI parameters for more information about URI mapping.
Read more >
Error when trying to Test RestClient #12585 - GitHub
The error Caused by: java.lang.IllegalArgumentException: RESTEASY003720: path param repo has not been provided by the parameter map was thrown ...
Read more >
RESTEasy JAX-RS - JBoss.org
The parameter type you inject into can be any primitive type, a String, or any Java object that has a constructor that takes...
Read more >
How to check REST invalid query parameter name with ...
You have to check that in your code. Query params are not in json in standard, you can do that with a class...
Read more >
Developing Web Services Applications Red Hat JBoss ...
Injecting an AsyncResponse as a parameter to your JAX-RS method prompts RESTEasy to detach the HTTP request and response from the thread being...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found