Skip to content

Build fails for @Provider exception mapper #4667

@blsouthr

Description

@blsouthr

starting with 0.23.2 I get
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.25.0:build (default) on project demo: Failed to build a runnable JAR: Failed to build a runner jar: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.arc.deployment.ArcProcessor#registerBeans threw an exception: javax.enterprise.inject.spi.DefinitionException: Bean class com.demo.excmapper.IllegalArgumentExceptionMapper declares multiple scope type annotations: javax.enterprise.context.Dependent, javax.inject.Singleton

Steps to reproduce the behavior:

  1. Create sample hello project
  2. Add the class
import org.eclipse.microprofile.metrics.Counter;
import org.eclipse.microprofile.metrics.annotation.Metric;

import javax.inject.Inject;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

@Provider
public class IllegalArgumentExceptionMapper implements ExceptionMapper<IllegalArgumentException> {
   
    @Inject
    @Metric(absolute = true, name = "error_count", description = "count", displayName = "error_count")
    private Counter counter;

    @Override
    public Response toResponse(IllegalArgumentException exception) {
        counter.inc();
        return Response.status(500).entity("illegal").build();
    }
}
  1. run mvn package
    getting-started.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions