cxf:rsServer requires class instead of interface in the serviceClass attribute in the camel route
Issue
- When CXF RS endpoint defined by using rsServer instruction, as below, the
com.sample.InterfaceDeclarationis declared as an interface, FUSE fails with the following exception:
<cxf:rsServer id="rsServer" address="" staticSubresourceResolution="true" serviceClass="rest.definition.RestInterfaceDeclaration loggingFeatureEnabled="true" loggingSizeLimit="20" skipFaultLogging="false">
<cxf:providers>
<ref bean="authorizationFilter"></ref>
</cxf:providers>
</cxf:rsServer>
Caused by: java.lang.RuntimeException: Resource class interface com.sample.InterfaceDeclaration has no valid constructor
at org.apache.cxf.jaxrs.lifecycle.PerRequestResourceProvider.<init>(PerRequestResourceProvider.java:46)[361:org.apache.cxf.cxf-rt-frontend-jaxrs:2.7.0.redhat-610379]
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:404)[361:org.apache.cxf.cxf-rt-frontend-jaxrs:2.7.0.redhat-610379]
- It works fine when we declare a class.
- According to the Redhat document it can be and should be declared as an interface. We believe it is a bug. It seems that there was an attempt to fix it already which resolved the issue for the camel endpoint declarations, but not for rsServer.
Environment
- Red Hat JBoss Fuse
- 6.x
- Apache Camel
- Apache CXF
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
