[英]No handler found for path in Helidon
I have created a simple endpoint in Helidon:我在 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
I receive:我收到:
No handler found for path: /sampleString
What am I missing?我错过了什么?
Most probably you are missing the META-INF/beans.xml
file.您很可能缺少
META-INF/beans.xml
文件。
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
.要检查它,您可以在
logging.properties
中设置org.jboss.level=DEBUG
。 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?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.