You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2009/11/24 12:33:52 UTC
[jira] Commented: (CAMEL-2219) The configure bean is not the
instance of org.apache.cxf.jaxrs.JAXRSServerFactoryBean
[ https://issues.apache.org/activemq/browse/CAMEL-2219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56049#action_56049 ]
Willem Jiang commented on CAMEL-2219:
-------------------------------------
@Charles
Because we use the cxf rs endpoint inside the camel, camel-cxf did some customer on the spring configuration.
You had to define the server endpoint for consumer, and client endpoint for the producer like this.
{code}
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
<cxf:rsServer id="rsServer" address="http://localhost:9000/router"
serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"/>
<cxf:rsClient id="rsClient" address="http://localhost:9002/helloworld"
serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"/>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxfrs://bean://rsServer"/>
<setHeader headerName="CamelCxfRsUsingHttpAPI">
<constant>True</constant>
</setHeader>
<to uri="cxfrs://bean://rsClient"/>
</route>
</camelContext>
</beans>
{code}
I will update the wiki page to add a spring configuration example.
> The configure bean is not the instance of org.apache.cxf.jaxrs.JAXRSServerFactoryBean
> -------------------------------------------------------------------------------------
>
> Key: CAMEL-2219
> URL: https://issues.apache.org/activemq/browse/CAMEL-2219
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-cxf
> Affects Versions: 2.1.0
> Reporter: Charles Moulliard
> Assignee: Willem Jiang
>
> camel - route defintion :
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <!--
> Licensed to the Apache Software Foundation (ASF) under one or more
> contributor license agreements. See the NOTICE file distributed with
> this work for additional information regarding copyright ownership.
> The ASF licenses this file to You under the Apache License, Version
> 2.0 (the "License"); you may not use this file except in compliance
> with the License. You may obtain a copy of the License at
> http://www.apache.org/licenses/LICENSE-2.0 Unless required by
> applicable law or agreed to in writing, software distributed under the
> License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
> CONDITIONS OF ANY KIND, either express or implied. See the License for
> the specific language governing permissions and limitations under the
> License.
> -->
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
> xmlns:camel="http://camel.apache.org/schema/spring"
> xmlns:osgi="http://www.springframework.org/schema/osgi"
> 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.xsd
> http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context.xsd
> http://www.springframework.org/schema/osgi
> http://www.springframework.org/schema/osgi/spring-osgi.xsd
> http://camel.apache.org/schema/osgi
> http://camel.apache.org/schema/osgi/camel-osgi.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">
> <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/cxf-extension-jaxrs-binding.xml" />
> <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
>
> <jaxrs:server id="restService"
> address="/report"
> staticSubresourceResolution="true">
> <jaxrs:serviceBeans>
> <ref bean="reportIncidentService"/>
> </jaxrs:serviceBeans>
> </jaxrs:server>
>
> <bean id="reportIncidentService" class="org.apache.camel.example.reportincident.restful.ReportIncidentService" />
> <cxf:rsClient id="rsClient" address="http://localhost:8080"
> serviceClass="org.apache.camel.example.reportincident.restful.ReportIncidentService" />
> <camel:camelContext trace="true"
> xmlns="http://camel.apache.org/schema/osgi">
> <camel:route>
> <camel:from uri="cxfrs://bean://rsClient" />
> <camel:setHeader headerName="CamelCxfRsUsingHttpAPI">
> <camel:constant>True</camel:constant>
> </camel:setHeader>
> <camel:to uri="log:org.apache.camel.example.reportIncident?level=INFO" />
> </camel:route>
> </camel:camelContext>
> </beans>
> {code}
> and error reported
> {code}
> karaf@root> Exception in thread "SpringOsgiExtenderThread-9" org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToStartRouteException: jav
> a.lang.IllegalArgumentException: The configure bean is not the instance of org.apache.cxf.jaxrs.JAXRSServerFactoryBean
> at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1039)
> at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
> at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:562)
> at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
> at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
> at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
> at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
> at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
> at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
> at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.ja
> va:358)
> at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
> at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplication
> Context.java:320)
> at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(Dependen
> cyWaiterApplicationContextExecutor.java:136)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: org.apache.camel.FailedToStartRouteException: java.lang.IllegalArgumentException: The configure bean is not the instance of org.apache.cxf.
> jaxrs.JAXRSServerFactoryBean
> at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:938)
> at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:197)
> at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
> ... 12 more
> Caused by: java.lang.IllegalArgumentException: The configure bean is not the instance of org.apache.cxf.jaxrs.JAXRSServerFactoryBean
> at org.apache.camel.component.cxf.jaxrs.CxfRsSpringEndpoint.checkBeanType(CxfRsSpringEndpoint.java:66)
> at org.apache.camel.component.cxf.jaxrs.CxfRsSpringEndpoint.setupJAXRSServerFactoryBean(CxfRsSpringEndpoint.java:71)
> at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createJAXRSServerFactoryBean(CxfRsEndpoint.java:152)
> at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.<init>(CxfRsConsumer.java:37)
> at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createConsumer(CxfRsEndpoint.java:103)
> at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60)
> at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83)
> at org.apache.camel.impl.RouteService.doStart(RouteService.java:123)
> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
> at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906)
> ... 14 more
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.