在 ServiceMix/FUSE 4.3 中部署多个 RESTful 服务包
我使用 apache-servicemix-4.3.0-fuse-03-00.tar.gz 附带的示例 cxf-jaxrs 来研究如何部署提供不同 RESTful 服务的多个包。我所做的是将 cxf-jaxrs 示例复制到 cxf-jaxrs-example-1 中,并修改 pom.xml 和 beans.xml。修改是:
1. pom.xml
version: 4.3.0-2-fuse-03-00
name: Apache ServiceMix Example 2:: CXF JAX-RS OSGI
2. beans.xml
<jaxrs:server id="customerService2" address="/crm2">
然后我做了两个包。一个是原始示例包cxf-jaxrs-4.3.0-fuse-03-00.jar,另一个是修改后的cxf-jaxrs-4.3.0-2-fuse-03-00.jar,我复制了它们进入“部署”目录。
servicemix 启动后,我看到两个捆绑包都处于活动状态并成功启动。
但是,我只能访问一个捆绑包中的 RESTful 服务。当我输入“http://localhost:8080/cxf/crm2/customerservice/customers/123”时,我得到“未找到服务”。错误。当我停止另一个示例包(原始包)时,我可以毫无问题地访问“http://localhost:8080/cxf/crm2/customerservice/customers/123”。
我做错了什么??它应该在上下文路径“/crm”和“/crm2”中提供 RESTful 服务。
I am using the example cxf-jaxrs shipped with apache-servicemix-4.3.0-fuse-03-00.tar.gz to investigate how to deploy multiple bundles which provides different RESTful services. What I did is copied the cxf-jaxrs example into cxf-jaxrs-example-1, and modified the pom.xml and beans.xml. The modifications are :
1. pom.xml
version: 4.3.0-2-fuse-03-00
name: Apache ServiceMix Example 2:: CXF JAX-RS OSGI
2. beans.xml
<jaxrs:server id="customerService2" address="/crm2">
Then I made two packages. The one is the original example package cxf-jaxrs-4.3.0-fuse-03-00.jar and the other is the modified one cxf-jaxrs-4.3.0-2-fuse-03-00.jar and I copied them into "deploy" directory.
After servicemix started, I see both bundles are active and started succesfully.
But, I am only able to access the RESTful services in one bundle. When I type "http://localhost:8080/cxf/crm2/customerservice/customers/123", I got "No service was found." error. And when I stop the other example bundle(the original one), I can access "http://localhost:8080/cxf/crm2/customerservice/customers/123" with no problems.
What I did wrong?? It is supposed to provides the RESTful services in both context path "/crm" and "/crm2".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题解决了。我的不好。我忘记修改 CustomerService 类上的路径注释
problem sovled. My bad. I forgot to modify the path annotation on CustomerService class