gpt4 book ai didi

java - Apache Camel 和 CXF : Mutlitple cxf:rsServer tags . 。这可能吗?

转载 作者:行者123 更新时间:2023-12-03 23:15:11 31 4
gpt4 key购买 nike

我一直在使用 cxf 和 camel 制作 Restful 网络服务,我遇到了一个奇怪的问题,我不知道这是正常的 camel 行为还是什么。

我有多个类公开为 Restful 服务并映射到不同的路径。首先,我的配置中只有 cxf,我可以同时将所有类公开为服务。现在我也在使用 Camel ,我有这样的标签:

    <camelcxf:rsServer id="rsServer1" address="/"
serviceClass="com.something.PoiSearchImpl">
</camelcxf:rsServer>
<camelcxf:rsServer id="rsServer2" address="/"
serviceClass="com.something.FooBarImpl">
</camelcxf:rsServer>

在此之后,我有两条路线从我的 cxf 端点(如上所述)开始并进行一些处理。问题是只有一个服务在工作,而其他服务只是没有被调用。它给了我 404 未找到错误。这是正常现象还是我的配置中缺少某些内容?

最佳答案

Hi Sikorski,Camel supports multiple cxf:rsServer. The problem with your approach is that both are mapped to an address '/'. This means that one of the servers is invoked. 

Solution: You need to have unique address for each rsServer like below,

<camelcxf:rsServer id="rsServer1" address="/Bar" serviceClass="com.something.PoiSearchImpl">
</camelcxf:rsServer>
<camelcxf:rsServer id="rsServer2" address="/Foo" serviceClass="com.something.FooBarImpl">
</camelcxf:rsServer>

关于java - Apache Camel 和 CXF : Mutlitple cxf:rsServer tags . 。这可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10450606/

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