On 2010-12-28, at 下午12:21, Dante Sun wrote:
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".
Hi,
Of course it's supposed to provide different RESTful services in
different context path.
But as your two services actually same(with same service module, which
build from same java class CustomerService.java, so the servicename
and port endpoint name is exactly same), I think in this case there
should be problem when register the service/endpoint to the cxf bus.
You can try to add serviceName attribute for <jaxrs:server
id="customerService2" address="/crm2">, to see if this helps.
Freeman
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org