Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 893AED87A for ; Mon, 31 Dec 2012 03:34:18 +0000 (UTC) Received: (qmail 37608 invoked by uid 500); 31 Dec 2012 03:34:18 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 36869 invoked by uid 500); 31 Dec 2012 03:34:14 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 36828 invoked by uid 99); 31 Dec 2012 03:34:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Dec 2012 03:34:12 +0000 Date: Mon, 31 Dec 2012 03:34:12 +0000 (UTC) From: "Jason Chaffee (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-4014) cxf:rsServer requires class instead of interface in the serviceClass attribute MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-4014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13541242#comment-13541242 ] Jason Chaffee commented on CAMEL-4014: -------------------------------------- I just tried this on 2.10.3 and I still get the "Resource class interface org.test.MyService has no valid constructor" error. > cxf:rsServer requires class instead of interface in the serviceClass attribute > ------------------------------------------------------------------------------ > > Key: CAMEL-4014 > URL: https://issues.apache.org/jira/browse/CAMEL-4014 > Project: Camel > Issue Type: Improvement > Components: camel-cxf > Affects Versions: 2.6.0, 2.7.0, 2.7.1 > Reporter: Sergey Zhemzhitsky > Assignee: Willem Jiang > Labels: camel, cxf, jaxrs > Fix For: 2.9.3, 2.10.1, 2.11.0 > > > Here are part of the conversation from the mailing list: > 1. > Hi there, > I'm using apache-servicemix-4.3.1-fuse-01-09 and I need to consume RESTful requests. > Here is the documentation I have used: http://camel.apache.org/cxfrs.html > Here is my configuration file > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:jaxrs="http://cxf.apache.org/jaxrs" > xmlns:cxf="http://camel.apache.org/schema/cxf" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd > http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd > http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd > "> > > > > > > > > > > Hello World!!! > > > > > Here is implementation of org.test.MyService > @Path("/service") > @Produces("application/json") > public class MyService { > @POST > @Path("/resource") > public Response add(@QueryParam("res") String res) { > return Response.ok(new Status("The Resource has been processed")).build(); > } > } > 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. > 2. > 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. > 3. > 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.(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. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira