Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

No handler found for path in Helidon

I have created a simple endpoint in Helidon:

@GET
@Path("/sampleString")
@Produces(MediaType.APPLICATION_JSON)
public Message getSampleString() {
    return "{'Sample':'String'}";
}

The code complies and runs. But when I call:

curl -i http://localhost:8080/sampleString

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I receive:

No handler found for path: /sampleString

What am I missing?

>Solution :

Most probably you are missing the META-INF/beans.xml file.

It should be as simple as that:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
                           https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
       version="3.0"
       bean-discovery-mode="annotated">
</beans>

To check it you may set org.jboss.level=DEBUG in logging.properties. When you run your app, you should see something like:

 WARNING io.helidon.microprofile.server.ServerCdiExtension Thread[#1,main,5,main]: There are no JAX-RS applications or resources. Maybe you forgot META-INF/beans.xml file?
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading