Hi,
You may need take a look at the new jaxrs feature and cxf-jaxrs example
added by Eoghan recently. I believe it exactly what you are looking for...
[1] tracked this issue.
[1]https://issues.apache.org/activemq/browse/SMX4-279
Freeman
Larry Cai wrote:
I deployed my simple restful bundle on SM 4.1 which include CXF
2.2.0.fuse and JSR311 API 1.0 (1.3.0.fuse). I already installed cxf-osgi
and the cxf-osgi-example is running fine. But my restful bundle didn't
work...
bean.xml:
...
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
<jaxrs:server id="customer" address="/customer ">
<jaxrs:serviceBeans>
<ref bean="customerService" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="customerService" class="com.customerService"/>
...
customerService class:
@Path("/")
public class CustomerFrontEnd{
@GET
@Path("/customers/{id}/")
public Customer getCustomer(@PathParam("id") String id)
{
return new Customer();
}
}
But I got following exceptions:
ERROR | xtenderThread-82 | OsgiBundleXmlApplicationContext |
gatedExecutionApplicationContext 366 | Post refresh error
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'customer ': Error setting property values; nested
exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'serviceBeans' threw exception; nested exception is
java.lang.NoClassDefFoundError
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1279)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native
Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObjec
t(AbstractBeanFactory.java:264)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.g
etSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(
AbstractBeanFactory.java:261)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:185)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:164)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.pre
InstantiateSingletons(DefaultListableBeanFactory.java:429)
at
org.springframework.context.support.AbstractApplicationContext.finishBea
nFactoryInitialization(AbstractApplicationContext.java:728)
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionAppli
cationContext.access$1600(AbstractDelegatedExecutionApplicationContext.j
ava:68)
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionAppli
cationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:34
3)
at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustom
TCCL(PrivilegedUtils.java:85)
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionAppli
cationContext.completeRefresh(AbstractDelegatedExecutionApplicationConte
xt.java:308)
at
org.springframework.osgi.extender.internal.dependencies.startup.Dependen
cyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWai
terApplicationContextExecutor.java:138)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'serviceBeans' threw exception; nested exception is
java.lang.NoClassDefFoundError
at
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(Abs
tractPropertyAccessor.java:104)
at
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(Abs
tractPropertyAccessor.java:59)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1276)
... 18 more
Can anybody help me?
Thanks,
Larry
--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com