Hi,

this is probably a bug in camel cxf that I found recently.

https://issues.apache.org/activemq/browse/CAMEL-2112

I guess you are using <context:annotation-config/> somewhere in your application context. If you leave this out it should work. The bug is fixed in current trunk in subversion already so the next camel version should have this fix. If you need a quick solution you can check out the camel source code and apply the patch from the issue above by hand. So you can make your own version that works.

Greetings

Christian


Coder One schrieb:
Hello,

I tried to to integrate CXF with Camel using the camel transport, and after 2 
days I am still out of luck.  Any help and pointers would be greatly 
appreciated.

Camel 2.0.0
Spring 2.5.6
CXF 2.2.4
ActiveMQ 5.3.0
JDK 1.6.17

Below is the strack trace from running the webapp in Tomcat 6.0.18.  At the 
bottom is my complete spring context for the client side.

Thanks

Nov 21, 2009 7:59:51 AM org.springframework.web.context.ContextLoader 
initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'org.apache.camel.component.cxf.transport.CamelTransportFactory#1': 
Injection of resource methods failed; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching 
bean of type [java.lang.String] found for dependency [collection of 
java.lang.String]: expected at least 1 bean which qualifies as autowire 
candidate for this dependency. Dependency annotations: {}
        at 
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:998)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
        at 
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
        at 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
        at 
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
        at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
        at 
org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1247)
        at 
org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:377)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:196)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No 
matching bean of type [java.lang.String] found for dependency [collection of 
java.lang.String]: expected at least 1 bean which qualifies as autowire 
candidate for this dependency. Dependency annotations: {}
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:726)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:571)
        at 
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:431)
        at 
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)
        at 
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:537)
        at 
org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:192)
        at 
org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:117)
        at 
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:302)
        ... 38 more
Nov 21, 2009 7:59:51 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart

============================================================

<?xml version="1.0" encoding="UTF-8"?>
<beans  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns="http://www.springframework.org/schema/beans";
        xmlns:context="http://www.springframework.org/schema/context";
        xmlns:camel="http://camel.apache.org/schema/spring";
        xmlns:aop="http://www.springframework.org/schema/aop";
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.0.0.xsd

        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
                http://cxf.apache.org/jaxws 
http://cxf.apache.org/schemas/jaxws.xsd             
                http://cxf.apache.org/transports/camel 
http://cxf.apache.org/transports/camel.xsd";>
<import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" />

        <!--  Directly defined ConnectionFactory  -->
    <bean id="jmsConnectionFactory" 
class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61616" />
    </bean>

        <!--  By defining a JmsComponent called jms you can use the JMS 
transport in routes
                You may define several of these components if you have 
different JMS servers for
                different services. They can be distinguished in the routes by 
their id
        -->
    <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="jmsConnectionFactory" />
        <property name="useMessageIDAsCorrelationID" value="true" />
    </bean>

        <!-- Add the camel transport to CXF. So you can define endpoint in the form 
camel://direct:<EndpointName>
             in cxf client and server endpoints. These endpoints are then 
available in camel
             as direct:<EndpointName> -->
    <bean 
class="org.apache.camel.component.cxf.transport.CamelTransportFactory">
        <property name="bus" ref="cxf" />
        <property name="camelContext" ref="camelContext" />
        <property name="transportIds">
            <list>
                <value>http://cxf.apache.org/transports/camel</value>
            </list>
        </property>
    </bean>

        <!-- Define a cxf endpoint based on client stub generated from a wsdl.
                It is important to provide serviceName and endpointName so the 
wsdl is not needed
                at runtime. As far as I know the serviceName and endpointName 
do not have to have a special
                convention but it is good practice to use the service namespace 
and Service Interface name in the names
         -->
    <client id="xyzService"
            xmlns="http://cxf.apache.org/jaxws";
            xmlns:xyzService="http://xyzService.example.com/";
            serviceName="xyzService:xyzServiceService"
            endpointName="xyzService:xyzServiceEndpoint"
            address="camel://direct:xyzService"
            serviceClass="abcorg.oam.services.xyzService">
        <features>
                        <!-- Enables logging of SOAP messages. -->
                        <!-- <logging xmlns="http://cxf.apache.org/core"; /> -->
        </features>
    </client>

        <!-- This context defines a route for each endpoint. For client 
endpoints you route from
                the cxf endpoint to the jms queue or topic. For servers you 
route from the jms queue or
                topic to the cxf endpoint -->
    <camel:camelContext id="camelContext" 
xmlns="http://camel.apache.org/camel/schema/spring";>
        <camel:route>
            <camel:from uri="direct:xyzService" />
            <camel:to uri="jms://queue:xyzService" />
        </camel:route>
    </camel:camelContext>

</beans>




--

Christian Schneider
---
http://www.liquid-reality.de

Reply via email to