Micronaut 2.0.0 "More than 1 route matched the incoming request"

Viewed 1215

I'm new to the micronaut framework, and I'm trying to get a simple web-app working. The app has one Controller "TestController", with two GET endpoints; one with a parameter and one without:

@Controller("/api/tests")
public class TestController

    @Get
    public HttpResponse<String> getAll()

    @Get("/{id}")
    public HttpResponse<String> getUserProfile(@NotBlank @PathVariable("id") long id)

This is just the class and method sigatures

I've generated the initial application code using the Micronaut Launch web-site (https://micronaut.io/launch/), selecting maven and JDK 1.8.

I compile and run the app using "mvn clean compile exec:exec" or "mvn mn:run".

When I attempt to call the endpoint with no parameters: "GET http://localhost:8080/api/tests"
I get: "More than 1 route matched the incoming request. The following routes matched /api/tests: GET - /api/tests, GET - /api/tests"

When I attempt to call the endpoint with a parameter: GET http://localhost:8080/api/tests/1
I get: "Page Not Found"

I'm running on Windows 10, using eclipse Version: 2019-12 (4.14.0) and JDK version 1.8.0_121-b13.

I've modified the POM to include for various micronaut processors. I've installed m2e in Eclipse and selected "Auto configure JDT APT" for annotation processing.

I would be grateful for any assistance on getting this simple application running. I've uploaded the source to Git Hub on https://github.com/phillwatson/upstart-failures

1 Answers

@JeffScottBrown Thank you for taking the time to look at this. Very much appreciated. Your example led me to the solution, although not quite as simple as using 2.0.0.RC2.

The cause of the issue was my inclusion of the micronauts.jaxrs library. Which, comparing your pom, you didn't have. I'm guessing that the jaxrs annotation processing was causing confusion with the micronaut http annotation. Whatever the underlying cause, removing any reference to jaxrs solved the issue.

Thanks again.

Related