gpt4 book ai didi

spring-boot - 由于检测到重复 ID : [B],无法启动路由 [A]

转载 作者:行者123 更新时间:2023-12-04 10:08:50 24 4
gpt4 key购买 nike

使用属性camel.springboot.xml-rests = classpath:folder-camel/folder-rest/*.xml中定义的XML路径通过“xml-rests”将rest定义加载到Camel Spring Boot 3.2时出现此错误

我的其余定义文件如下所示

<?xml version="1.0" encoding="UTF-8"?>
<rests xmlns="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://camel.apache.org/schema/spring https://camel.apache.org/schema/spring/camel-spring-3.2.0.xsd
">
<rest id="id1" path="/test">
<get id="id2" uri="/folderuri">
<to id="id3" uri="log:test-log-rest-route" />
</get>
</rest>
</rests>

异常堆栈跟踪是
org.apache.camel.FailedToStartRouteException: Failed to start route first-test-get-id because of duplicate id detected: first-test-to-id. Please correct ids to be unique among all your routes.
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:344)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:327)
at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2598)
at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2431)
at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2448)
at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:121)
at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:373)
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:420)
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:94)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)

最佳答案

问题CAMEL-14969 , 是由于其余点的生产者和消费者路线被命名相同造成的。一种可能的解决方法是引入带有单独 ID 的 ROUTE 标记,以便传入的休息和传出的路由具有不同的 ID

<?xml version="1.0" encoding="UTF-8"?>
<rests xmlns= . . . >
<rest id="id1" path="/test">
<get id="id2" uri="/folderuri">
<route id="id4">
<to id="id3" uri="log:test-log-rest-route" />
</route>
</get>
</rest>
</rests>

关于spring-boot - 由于检测到重复 ID : [B],无法启动路由 [A],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61438807/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com