简体   繁体   English

在 Helidon 中找不到路径的处理程序

[英]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.

相关问题 错误 Helidon se 项目中不存在指定的文件“helidon-quickstart-se.jar” - ERROR The specified file 'helidon-quickstart-se.jar' not exists in helidon se project 安装JHipster注册表错误:在模块路径或类路径上未找到JAXB-API的实现 - Install JHipster Registry error: Implementation of JAXB-API has not been found on module path or classpath javax.servlet.ServletException: Circular view path [error]: 将再次调度回当前处理程序 URL [/error] - Spring Cloud - javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/error] again - Spring Cloud MediatR 命令处理程序中的数组请求 - Array request in MediatR command handler Rest 服务调用未触发处理程序 - Rest service call is not triggering the handler NestJS 微服务错误与“没有匹配的消息处理程序” - NestJS microservices error with "No matching message handler" Spring 引导中多个项目中的错误处理程序 - Error Handler in Multiple Projects in Spring Boot 找不到:NGINX Ingress - getting not found: NGINX Ingress 如何在数据库更改时重新评估 promhttp.Handler? - How to re-evaluate promhttp.Handler on database change? KrakenD 包罗万象的路径 - KrakenD catchall path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM