![](/img/trans.png)
[英]Quarkus with Camel call external endpoint. Error: Map at least one servlet to a path using quarkus.camel.servlet.url-patterns
[英]Camel with servlet not starting in quarkus
我正在嘗試使用 Apache 駱駝和 Quarkus 啟動我的應用程序,但它給了我以下錯誤:
At least one bean matched the required type and qualifiers but was marked as unused and removed during build Removed beans: - CLASS bean org.apache.camel.component.servlet.CamelHttpTransportServlet [types=[class javax.servlet.http.HttpServlet, interface java.io.Serializable, class org.apache.camel.http.common.CamelServlet, interface javax.servlet.ServletConfig, interface org.apache.camel.http.common.HttpRegistryProvider, class org.apache.camel.component.servlet. CamelHttpTransportServlet, class javax.servlet.GenericServlet, 接口 javax.servlet.Servlet], qualifiers=[@javax.enterprise.inject.Default(), @javax.en terprise.inject.Any()]] 必需類型:class org.apache.camel.component.servlet.CamelHttpTransportServlet 必需限定符:[@javax.enterprise.inject.Default()] 解決方案:- 應用程序開發人員可以消除誤報@Unremovable 注釋 - 擴展可以通過構建項消除誤報,例如使用 UnremovableBeanBuildItem
我不確定我錯過了什么:
application.properties
camel.context.name=aiv
quarkus.camel.servlet.url-patterns = /rest/*
pom.xml
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-main</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-platform-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-log</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-timer</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-servlet</artifactId>
</dependency>
public class CamelRoute extends RouteBuilder {
@Override
public void configure() {
restConfiguration()
.component("servlet");
...
}
}
請讓我知道我做錯了什么?
除非您出於某種原因確實需要 Servlet 支持,否則您可以依靠camel-quarkus-platform-http
來處理 Camel REST DSL 的 HTTP 傳輸。
您的依賴關系可以簡化為:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-main</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-log</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-timer</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-rest</artifactId>
</dependency>
Camel Quarkus 文檔中有更多信息:
https://camel.apache.org/camel-quarkus/latest/reference/extensions/platform-http.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.