You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jsbournival <js...@jipiju.com> on 2009/04/20 16:13:17 UTC

Multiple REST services on SM4/OSGi

Hi, I'm having a hard time answering an architectural question regarding the
deployment of rest services on FuseESB/SM 4. Maybe someone could give me
hints on how to resolve it.

We want to provide multiple restful services (i.e. deploy multiple bundle,
each one of them containing a JAX-RS class dedicated to operations on a
particular resource). These bundles will depend on other bundles (spring
services etc.).

AFAIK, configuring a restful service requires to specify this snippet of XML
code in the spring meta-inf file:

<jaxrs:server address="http://localhost:9080/">
<jaxrs:serviceBeans>
<ref bean="restfulService"/>
</jaxrs:serviceBeans>
</jaxrs:server>

It's working fine.

What is bugging me is the fact that I need to pick a server address, with a
port. What if 3 people are working on 3 different bundle containing a JAX-RS
service. Do they need to verify if a particular port has already been taken?
Sounds a little silly to me. I don't want the developers to be exposed to
this.

So my question is how can I configure (or redesign) my stuff so that CXF
picks all my JAX-RS bundle, without tying them together, all on one
predefined HTTP listener? (maybe I'm asking too much/don't get what it's all
about, but I need to understand).

The reason why I want to package a restful service in its own bundle, is to
beneficiate from the modular nature of OSGi, i.e. to take down one service
without affecting the others. 

It's also obiously good for parallel development among our team.

Thank you for your answers!

JS.
-- 
View this message in context: http://www.nabble.com/Multiple-REST-services-on-SM4-OSGi-tp23137516p23137516.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Multiple REST services on SM4/OSGi

Posted by jsbournival <js...@jipiju.com>.
I figured it out.  I was missing some stuff.

Look here 
http://www.nabble.com/Problems-wiring-beans-in-Spring-td19508425.html
http://www.nabble.com/Problems-wiring-beans-in-Spring-td19508425.html 

JS.



jsbournival wrote:
> 
> I installed the CXF transport OSGi feature (Thnx Eoghan!).  Next, I
> changed JAX-RS service conf to:
> 
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
> 
> <jaxrs:server address="/news">
> 	<jaxrs:serviceBeans>
> 		<ref bean="newsRestService" />
> 	</jaxrs:serviceBeans>
> </jaxrs:server>
> 
> But when I update my bundle, I have this wonderful stack trace.  Rings a
> bell?
> 
> 
> 
> %< paste stack trace -----------------------
> 
> org.apache.cxf.BusException: No binding factory for namespace
> http://apache.org/cxf/binding/jaxrs registered.
> 	at
> org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:91)
> 	at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.createBindingInfo(JAXRSServerFactoryBean.java:240)
> 	at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.createEndpointInfo(JAXRSServerFactoryBean.java:220)
> 	at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.createEndpoint(JAXRSServerFactoryBean.java:165)
> 	at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:107)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 	at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 	at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> 	at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
> 	at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276)
> 	at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
> 	at java.lang.Thread.run(Thread.java:613)
> 21 avr. 2009 11:55:51 org.apache.cxf.endpoint.ServerImpl initDestination
> INFO: Setting the server's publish address to be /news
> Exception in thread "SpringOsgiExtenderThread-69"
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name
> 'org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean--774106560':
> Invocation of init method failed; nested exception is
> java.lang.NullPointerException
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 	at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 	at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> 	at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
> 	at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276)
> 	at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
> 	at java.lang.Thread.run(Thread.java:613)
> Caused by: java.lang.NullPointerException
> 	at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:122)
> 	at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:128)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> 	... 14 more
> 
> %< paste stack trace -----------------------
> 
> Thanks
> 
> JS.
> 
> 
> 
> 
> 
> Eoghan Glynn-4 wrote:
>> 
>> 2009/4/20 Charles Moulliard <cm...@gmail.com>:
>>> JS,
>>>
>>> Have you installed on SMX4 the following bundle :
>>>
>>> <bundle>mvn:org.apache.servicemix.cxf/org.apache.servicemix.cxf.transport.osgi/4.0.0</bundle>
>> 
>> Or alternatively just install the cxf-osgi feature, i.e.
>> 
>>   features install cxf-osgi
>> 
>> which will pull in all the bundles you need.
>> 
>> Cheers,
>> Eoghan
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-REST-services-on-SM4-OSGi-tp23137516p23160959.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Multiple REST services on SM4/OSGi

Posted by jsbournival <js...@jipiju.com>.
I installed the CXF transport OSGi feature (Thnx Eoghan!).  Next, I changed
JAX-RS service conf to:

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />

<jaxrs:server address="/news">
	<jaxrs:serviceBeans>
		<ref bean="newsRestService" />
	</jaxrs:serviceBeans>
</jaxrs:server>

But when I update my bundle, I have this wonderful stack trace.  Rings a
bell?



%< paste stack trace -----------------------

org.apache.cxf.BusException: No binding factory for namespace
http://apache.org/cxf/binding/jaxrs registered.
	at
org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:91)
	at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.createBindingInfo(JAXRSServerFactoryBean.java:240)
	at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.createEndpointInfo(JAXRSServerFactoryBean.java:220)
	at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.createEndpoint(JAXRSServerFactoryBean.java:165)
	at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:107)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
	at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
	at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276)
	at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
	at java.lang.Thread.run(Thread.java:613)
21 avr. 2009 11:55:51 org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be /news
Exception in thread "SpringOsgiExtenderThread-69"
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name
'org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean--774106560':
Invocation of init method failed; nested exception is
java.lang.NullPointerException
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
	at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
	at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276)
	at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
	at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.NullPointerException
	at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:122)
	at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:128)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
	... 14 more

%< paste stack trace -----------------------

Thanks

JS.





Eoghan Glynn-4 wrote:
> 
> 2009/4/20 Charles Moulliard <cm...@gmail.com>:
>> JS,
>>
>> Have you installed on SMX4 the following bundle :
>>
>> <bundle>mvn:org.apache.servicemix.cxf/org.apache.servicemix.cxf.transport.osgi/4.0.0</bundle>
> 
> Or alternatively just install the cxf-osgi feature, i.e.
> 
>   features install cxf-osgi
> 
> which will pull in all the bundles you need.
> 
> Cheers,
> Eoghan
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-REST-services-on-SM4-OSGi-tp23137516p23159285.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Multiple REST services on SM4/OSGi

Posted by Eoghan Glynn <eo...@gmail.com>.
2009/4/20 Charles Moulliard <cm...@gmail.com>:
> JS,
>
> Have you installed on SMX4 the following bundle :
>
> <bundle>mvn:org.apache.servicemix.cxf/org.apache.servicemix.cxf.transport.osgi/4.0.0</bundle>

Or alternatively just install the cxf-osgi feature, i.e.

  features install cxf-osgi

which will pull in all the bundles you need.

Cheers,
Eoghan

Re: Multiple REST services on SM4/OSGi

Posted by Charles Moulliard <cm...@gmail.com>.
JS,

Have you installed on SMX4 the following bundle :

<bundle>mvn:org.apache.servicemix.cxf/org.apache.servicemix.cxf.transport.osgi/4.0.0</bundle>

and add the following line(s) in your spring XML config file :

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />


Regards,

Charles




On Mon, Apr 20, 2009 at 5:14 PM, jsbournival <js...@jipiju.com> wrote:

>
> Fair enough.
>
> But how do I tell Fuse/SM to use the "cxf-transport-osgi servlet style
> transport" ?
>
> Thanks for your answers.
>
> JS.
>
>
>
> Eoghan Glynn-4 wrote:
> >
> > 2009/4/20 jsbournival <js...@jipiju.com>:
> >>
> >> AFAIK, configuring a restful service requires to specify this snippet of
> >> XML
> >> code in the spring meta-inf file:
> >>
> >> <jaxrs:server address="http://localhost:9080/">
> >> <jaxrs:serviceBeans>
> >> <ref bean="restfulService"/>
> >> </jaxrs:serviceBeans>
> >> </jaxrs:server>
> >>
> >> It's working fine.
> >>
> >> What is bugging me is the fact that I need to pick a server address,
> with
> >> a
> >> port. What if 3 people are working on 3 different bundle containing a
> >> JAX-RS
> >> service.
> >
> > If you're using the cxf-transport-osgi servlet style transport, then
> > you do not need to specify the full listen URI (i.e.
> > "http://localhost:9080/" in your case).
> >
> > Instead you can just specify the context path in <jaxrs:server>
> > address attribute, and this is appended to a root URI of
> > http://localhost:8080/cxf, or whatever port you've configured.
> >
> > So for example, your three bundles could be configured like so:
> >
> > <jaxrs:server address="/first" ...>
> >
> > <jaxrs:server address="/second" ...>
> >
> > <jaxrs:server address="/third" ...>
> >
> > BTW I'm working thru' some minor issues in using CXF JAX-RS with the
> > cxf-transport-osgi stuff, but it should be working soon.
> >
> > Cheers,
> > Eoghan
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Multiple-REST-services-on-SM4-OSGi-tp23137516p23138707.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: Multiple REST services on SM4/OSGi

Posted by jsbournival <js...@jipiju.com>.
Fair enough.  

But how do I tell Fuse/SM to use the "cxf-transport-osgi servlet style
transport" ?

Thanks for your answers.

JS.



Eoghan Glynn-4 wrote:
> 
> 2009/4/20 jsbournival <js...@jipiju.com>:
>>
>> AFAIK, configuring a restful service requires to specify this snippet of
>> XML
>> code in the spring meta-inf file:
>>
>> <jaxrs:server address="http://localhost:9080/">
>> <jaxrs:serviceBeans>
>> <ref bean="restfulService"/>
>> </jaxrs:serviceBeans>
>> </jaxrs:server>
>>
>> It's working fine.
>>
>> What is bugging me is the fact that I need to pick a server address, with
>> a
>> port. What if 3 people are working on 3 different bundle containing a
>> JAX-RS
>> service.
> 
> If you're using the cxf-transport-osgi servlet style transport, then
> you do not need to specify the full listen URI (i.e.
> "http://localhost:9080/" in your case).
> 
> Instead you can just specify the context path in <jaxrs:server>
> address attribute, and this is appended to a root URI of
> http://localhost:8080/cxf, or whatever port you've configured.
> 
> So for example, your three bundles could be configured like so:
> 
> <jaxrs:server address="/first" ...>
> 
> <jaxrs:server address="/second" ...>
> 
> <jaxrs:server address="/third" ...>
> 
> BTW I'm working thru' some minor issues in using CXF JAX-RS with the
> cxf-transport-osgi stuff, but it should be working soon.
> 
> Cheers,
> Eoghan
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-REST-services-on-SM4-OSGi-tp23137516p23138707.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Multiple REST services on SM4/OSGi

Posted by Eoghan Glynn <eo...@gmail.com>.
2009/4/20 jsbournival <js...@jipiju.com>:
>
> AFAIK, configuring a restful service requires to specify this snippet of XML
> code in the spring meta-inf file:
>
> <jaxrs:server address="http://localhost:9080/">
> <jaxrs:serviceBeans>
> <ref bean="restfulService"/>
> </jaxrs:serviceBeans>
> </jaxrs:server>
>
> It's working fine.
>
> What is bugging me is the fact that I need to pick a server address, with a
> port. What if 3 people are working on 3 different bundle containing a JAX-RS
> service.

If you're using the cxf-transport-osgi servlet style transport, then
you do not need to specify the full listen URI (i.e.
"http://localhost:9080/" in your case).

Instead you can just specify the context path in <jaxrs:server>
address attribute, and this is appended to a root URI of
http://localhost:8080/cxf, or whatever port you've configured.

So for example, your three bundles could be configured like so:

<jaxrs:server address="/first" ...>

<jaxrs:server address="/second" ...>

<jaxrs:server address="/third" ...>

BTW I'm working thru' some minor issues in using CXF JAX-RS with the
cxf-transport-osgi stuff, but it should be working soon.

Cheers,
Eoghan