As the CXF RS need to instantiate the resource class to navigate the resource. That is why we need the serviceClass to be class instead of interface.

On 5/26/11 3:37 PM, Zhemzhitsky Sergey wrote:
Hi Willem, Ben

Thanks for the information.
I tried to use the interface instead of class in the serviceClass attribute and 
I didn't succeed because of an exception that told that the class is required.
Here is the exception:

Caused by: java.lang.RuntimeException: Resource class interface 
org.test.MyService has no valid constructor
         at 
org.apache.cxf.jaxrs.lifecycle.PerRequestResourceProvider.<init>(PerRequestResourceProvider.java:45)
         at 
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:338)
         at 
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:119)
         ... 26 more

I think that using an interface would be better in that case so I have reported 
the issue: https://issues.apache.org/jira/browse/CAMEL-4014


Best Regards,
Sergey Zhemzhitsky


-----Original Message-----
From: Willem Jiang [mailto:[email protected]]
Sent: Thursday, May 26, 2011 7:46 AM
To: [email protected]
Subject: Re: Camel CXF RS Consumer. Why serviceClass is required?

Hi Ben,

You are right, the serviceClass is just used to build up the JAXRS service 
module. And Camel CXF RS Consumer doesn't all serviceClass instance at the end, 
it just route the request to the camel route.

On 5/25/11 11:31 PM, boday wrote:
Sergey, I've wondered this myself.  The serviceClass appears to just
be used to configure the endpoint based on class/method level
annotations...nothing more.  I'll look into it...or perhaps one of the
more CXF savvy users can comment of this...


Sergey_Zhemzhitsky wrote:

I'm wondering why we have to specify the serviceClass attribute and
why this attribute should point at the real class. I'm asking because
the response of such a service will always be "Hello World!!!" and
implementation of MyService.add method does not matter in that case.

Best Regards,
Sergey Zhemzhitsky



-----
Ben O'Day
IT Consultant -http://benoday.blogspot.com

--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-CXF-RS-Consumer-Why-serviceCla
ss-is-required-tp4424498p4425664.html
Sent from the Camel - Users mailing list archive at Nabble.com.


--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
           http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com

_______________________________________________________

The information contained in this message may be privileged and conf idential 
and protected from disclosure. If you are not the original intended recipient, 
you are hereby notified that any review, retransmission, dissemination, or 
other use of, or taking of any action in reliance upon, this information is 
prohibited. If you have received this communication in error, please notify the 
sender immediately by replying to this message and delete it from your 
computer. Thank you for your cooperation. Troika Dialog, Russia.
If you need assistance please contact our Contact Center  (+7495) 258 0500 or 
go to www.troika.ru/eng/Contacts/system.wbp





--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com

Reply via email to