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

@ServerResponseFilter and @ServerRequestFilter fails on startup with NoSuchMethodException #29170

Closed
computerlove opened this issue Nov 10, 2022 · 7 comments · Fixed by #29171
Assignees
Labels
area/resteasy-reactive kind/bug Something isn't working
Milestone

Comments

@computerlove
Copy link
Contributor

Describe the bug

When upgrading to Quarkus 2.14.10 startup of application with @ServerResponseFilter and @ServerRequestFilter crash on startup with

... 
Caused by: java.lang.NoSuchMethodException: org.acme.RequestLogger$GeneratedServerRequestFilter$filter.<init>()
	at java.base/java.lang.Class.getConstructor0(Class.java:3617)
	at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2786)
	at io.quarkus.arc.runtime.BeanContainerImpl$DefaultInstanceFactory.create(BeanContainerImpl.java:78)
	... 26 more

(Or org.acme.RequestLogger$GeneratedServerResponseFilter$filter.())

Expected behavior

The filters are created and app starts successfully

Actual behavior

Application crash on startup

How to Reproduce?

https://github.com/computerlove/NoSuchMethodException-GeneratedServerRequestFilter
The application crash on startup when running mvn quarkus:dev

Output of uname -a or ver

No response

Output of java -version

17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.14.0

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

No response

Additional information

No response

@computerlove computerlove added the kind/bug Something isn't working label Nov 10, 2022
@geoand
Copy link
Contributor

geoand commented Nov 10, 2022

@mkouba this looks like an Arc problem.

The generated code from RESTEasy Reactive looks like:

@Unremovable
public class RequestLogger$GeneratedServerRequestFilter$filter implements ContainerRequestFilter {
   private final RequestLogger delegate;

   @Inject
   public RequestLogger$GeneratedServerRequestFilter$filter(RequestLogger var1) {
      this.delegate = var1;
   }

   public void filter(ContainerRequestContext var1) {
      ResteasyReactiveContainerRequestContext var2 = (ResteasyReactiveContainerRequestContext)var1;
      RequestLogger var3 = this.delegate;
      ResteasyReactiveRequestContext var10000 = (ResteasyReactiveRequestContext)var2.getServerRequestContext();
      PreventAbortResteasyReactiveContainerRequestContext var4 = new PreventAbortResteasyReactiveContainerRequestContext(var1);
      var3.filter((ContainerRequestContext)var4);
   }
}

however as you can see from the stacktrace, Arc is looking for a no-args constructor

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 10, 2022

/cc @FroMage, @stuartwdouglas

@geoand geoand added the area/arc Issue related to ARC (dependency injection) label Nov 10, 2022
@geoand
Copy link
Contributor

geoand commented Nov 10, 2022

Actually there may be more to it... I need to take another look

@geoand geoand self-assigned this Nov 10, 2022
@geoand geoand removed the area/arc Issue related to ARC (dependency injection) label Nov 10, 2022
geoand added a commit to geoand/quarkus that referenced this issue Nov 10, 2022
@geoand
Copy link
Contributor

geoand commented Nov 10, 2022

It was a mistake on my part. #29171 fixes the issue

geoand added a commit that referenced this issue Nov 10, 2022
Fix CDI scope for classes that declare @ServerRequestFilter
@quarkus-bot quarkus-bot bot added this to the 2.15 - main milestone Nov 10, 2022
@geoand
Copy link
Contributor

geoand commented Nov 10, 2022

@gsmet this seems like a very nasty one that slipped through, so if possible, it would probably make sense to not wait long for 2.14.1

@gsmet
Copy link
Member

gsmet commented Nov 10, 2022

@geoand I can do one on Tuesday but not before that. I think it should work, people can use 2.13.4.Final until then.

@geoand
Copy link
Contributor

geoand commented Nov 10, 2022

Sounds good, thanks!

And yes. 2.13.4 does not suffer from the same problem

@gsmet gsmet modified the milestones: 2.15 - main, 2.14.1.Final Nov 10, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 10, 2022
pedroh-pereira pushed a commit to pedroh-pereira/quarkus that referenced this issue Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/resteasy-reactive kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants