You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Coder One <co...@yahoo.com> on 2009/11/21 17:05:52 UTC

CXF & Camel & Spring & ActiveMQ Integration Problems

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>


      

Re: CXF & Camel & Spring & ActiveMQ Integration Problems

Posted by Coder One <co...@yahoo.com>.
It's on the client side.  The "NewServlet" is a client to the actual web service.

In the simple front-end case, <property name="address" value="${xyz.loginServiceAdress}"/> points CXF to the WSDL, and I figure that's how CXF can auto-generate the stub on the fly behind the scene.  In my code first approach, I don't go through the step of generating binding code from a WSDL.

In the CXF/Camel case I tried, there is no reference to an actual WSDL, so I figure that's where the disconnect lies.

Going to try Christian proposal and look into the WSDL first examle to see if I can modify it to go with a code-first/code-only approach...

Thanks...

--- On Sun, 11/22/09, Willem Jiang <wi...@gmail.com> wrote:

> From: Willem Jiang <wi...@gmail.com>
> Subject: Re: CXF & Camel & Spring & ActiveMQ Integration Problems
> To: users@cxf.apache.org
> Date: Sunday, November 22, 2009, 7:34 PM
> Hi,
> 
> Did the SEI class is created by using WSDL2Java?
> If so , it must have some @WebService annotation, which let
> you get the 
> trouble of WebServiceException.
> 
> But from Stack trace I think the error is thrown from the
> service side, 
> it have nothing to do with you client configuration.
> 
> Can you recheck the configuration on the server side?
> 
> Willem
> 
> Coder One wrote:
> > Well, the app started, but as soon I invoked the
> function, I got this...
> > 
> > SEVERE: Servlet.service() for servlet NewServlet threw
> exception
> > javax.xml.ws.WebServiceException: Could not find
> wsdl:binding operation info for web method
> getMyHelloService
> > 
> > Do I absolutely need to have a local WSDL?  I
> already got the "interface" classes from the server.
> > 
> > I think that's because I use frontend-simple and I
> have no WSDL locally.  Here is what I used to just need
> on the client side for another project.
> > 
> >     <bean
> id="loginServiceAegisDataBinding"
> class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
> >     
> >     <bean id="loginService"
> >       
>    class="abc.xyz.services.loginmgmt.LoginService"
> >       
>    factory-bean="loginServiceClientFactory"
> factory-method="create"/>
> > 
> >     <bean
> id="loginServiceClientFactory"
> class="org.apache.cxf.frontend.ClientProxyFactoryBean">
> >         <property
> name="serviceClass"
> value="abc.xyz.services.loginmgmt.LoginService"/>
> >         <property
> name="address" value="${xyz.loginServiceAdress}"/>
> >         <property
> name="dataBinding" ref="loginServiceAegisDataBinding"/>
> >     </bean>
> > 
> > 
> > Thanks,
> > 
> > --- On Sat, 11/21/09, Coder One <co...@yahoo.com>
> wrote:
> > 
> >> From: Coder One <co...@yahoo.com>
> >> Subject: Re: CXF & Camel & Spring &
> ActiveMQ Integration Problems
> >> To: users@cxf.apache.org
> >> Date: Saturday, November 21, 2009, 9:19 AM
> >> You are right.  After removing
> >> <context:annotation-config/>", it works. My
> webapp
> >> loaded the wrong spring-context.xml.
> >>
> >> Thanks,
> >>
> >> --- On Sat, 11/21/09, Christian Schneider <ch...@die-schneider.net>
> >> wrote:
> >>
> >>> From: Christian Schneider <ch...@die-schneider.net>
> >>> Subject: Re: CXF & Camel & Spring
> &
> >> ActiveMQ Integration Problems
> >>> To: users@cxf.apache.org
> >>> Date: Saturday, November 21, 2009, 8:35 AM
> >>> Hmm,
> >>>
> >>> after looking closer at your context there was
> no
> >>> annotation config. But the stacktrace still
> seems to
> >> point
> >>> to the CommonAnnotationBeanPostProcessor. Are
> you sure
> >> the
> >>> context you posted is complete?
> >>> If yes it seems spring is configured in some
> other way
> >> to
> >>> interpret annotations. Are you using junit 4
> tests
> >>> somewhere?
> >>>
> >>> Greetings
> >>>
> >>> Christian
> >>>
> >>>
> >>> Christian Schneider schrieb:
> >>>> 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
> >>>>
> >>>>
> >>> -- 
> >>> Christian Schneider
> >>> ---
> >>> http://www.liquid-reality.de
> >>>
> >>>
> >>
> >>       
> >>
> > 
> > 
> >       
> > 
> 
> 


      

Re: CXF & Camel & Spring & ActiveMQ Integration Problems

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

Did the SEI class is created by using WSDL2Java?
If so , it must have some @WebService annotation, which let you get the 
trouble of WebServiceException.

But from Stack trace I think the error is thrown from the service side, 
it have nothing to do with you client configuration.

Can you recheck the configuration on the server side?

Willem

Coder One wrote:
> Well, the app started, but as soon I invoked the function, I got this...
> 
> SEVERE: Servlet.service() for servlet NewServlet threw exception
> javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method getMyHelloService
> 
> Do I absolutely need to have a local WSDL?  I already got the "interface" classes from the server.
> 
> I think that's because I use frontend-simple and I have no WSDL locally.  Here is what I used to just need on the client side for another project.
> 
>     <bean id="loginServiceAegisDataBinding" class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
>     
>     <bean id="loginService"
>           class="abc.xyz.services.loginmgmt.LoginService"
>           factory-bean="loginServiceClientFactory" factory-method="create"/>
> 
>     <bean id="loginServiceClientFactory" class="org.apache.cxf.frontend.ClientProxyFactoryBean">
>         <property name="serviceClass" value="abc.xyz.services.loginmgmt.LoginService"/>
>         <property name="address" value="${xyz.loginServiceAdress}"/>
>         <property name="dataBinding" ref="loginServiceAegisDataBinding"/>
>     </bean>
> 
> 
> Thanks,
> 
> --- On Sat, 11/21/09, Coder One <co...@yahoo.com> wrote:
> 
>> From: Coder One <co...@yahoo.com>
>> Subject: Re: CXF & Camel & Spring & ActiveMQ Integration Problems
>> To: users@cxf.apache.org
>> Date: Saturday, November 21, 2009, 9:19 AM
>> You are right.  After removing
>> <context:annotation-config/>", it works. My webapp
>> loaded the wrong spring-context.xml.
>>
>> Thanks,
>>
>> --- On Sat, 11/21/09, Christian Schneider <ch...@die-schneider.net>
>> wrote:
>>
>>> From: Christian Schneider <ch...@die-schneider.net>
>>> Subject: Re: CXF & Camel & Spring &
>> ActiveMQ Integration Problems
>>> To: users@cxf.apache.org
>>> Date: Saturday, November 21, 2009, 8:35 AM
>>> Hmm,
>>>
>>> after looking closer at your context there was no
>>> annotation config. But the stacktrace still seems to
>> point
>>> to the CommonAnnotationBeanPostProcessor. Are you sure
>> the
>>> context you posted is complete?
>>> If yes it seems spring is configured in some other way
>> to
>>> interpret annotations. Are you using junit 4 tests
>>> somewhere?
>>>
>>> Greetings
>>>
>>> Christian
>>>
>>>
>>> Christian Schneider schrieb:
>>>> 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
>>>>
>>>>
>>> -- 
>>> Christian Schneider
>>> ---
>>> http://www.liquid-reality.de
>>>
>>>
>>
>>       
>>
> 
> 
>       
> 


Re: CXF & Camel & Spring & ActiveMQ Integration Problems

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi,

I am not sur about the simple frontend but in the jax ws frontend it is 
possible to have no wsdl. In that case you have to set the servicename 
and the portname to arbitrary values. Perhaps something like
this is also necessary for simple frontend.  In general I would 
recommend to switch to the jax ws frontend. There is an example in the 
distribution called wsdl_first. But you can also use this example with 
code first with minor changes.

Greetings

Christian


Coder One schrieb:
> Well, the app started, but as soon I invoked the function, I got this...
>
> SEVERE: Servlet.service() for servlet NewServlet threw exception
> javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method getMyHelloService
>
> Do I absolutely need to have a local WSDL?  I already got the "interface" classes from the server.
>
> I think that's because I use frontend-simple and I have no WSDL locally.  Here is what I used to just need on the client side for another project.
>
>     <bean id="loginServiceAegisDataBinding" class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
>     
>     <bean id="loginService"
>           class="abc.xyz.services.loginmgmt.LoginService"
>           factory-bean="loginServiceClientFactory" factory-method="create"/>
>
>     <bean id="loginServiceClientFactory" class="org.apache.cxf.frontend.ClientProxyFactoryBean">
>         <property name="serviceClass" value="abc.xyz.services.loginmgmt.LoginService"/>
>         <property name="address" value="${xyz.loginServiceAdress}"/>
>         <property name="dataBinding" ref="loginServiceAegisDataBinding"/>
>     </bean>
>
>
> Thanks,
>
> --- On Sat, 11/21/09, Coder One <co...@yahoo.com> wrote:
>   

-- 

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


Re: CXF & Camel & Spring & ActiveMQ Integration Problems

Posted by Coder One <co...@yahoo.com>.
Well, the app started, but as soon I invoked the function, I got this...

SEVERE: Servlet.service() for servlet NewServlet threw exception
javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method getMyHelloService

Do I absolutely need to have a local WSDL?  I already got the "interface" classes from the server.

I think that's because I use frontend-simple and I have no WSDL locally.  Here is what I used to just need on the client side for another project.

    <bean id="loginServiceAegisDataBinding" class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
    
    <bean id="loginService"
          class="abc.xyz.services.loginmgmt.LoginService"
          factory-bean="loginServiceClientFactory" factory-method="create"/>

    <bean id="loginServiceClientFactory" class="org.apache.cxf.frontend.ClientProxyFactoryBean">
        <property name="serviceClass" value="abc.xyz.services.loginmgmt.LoginService"/>
        <property name="address" value="${xyz.loginServiceAdress}"/>
        <property name="dataBinding" ref="loginServiceAegisDataBinding"/>
    </bean>


Thanks,

--- On Sat, 11/21/09, Coder One <co...@yahoo.com> wrote:

> From: Coder One <co...@yahoo.com>
> Subject: Re: CXF & Camel & Spring & ActiveMQ Integration Problems
> To: users@cxf.apache.org
> Date: Saturday, November 21, 2009, 9:19 AM
> You are right.  After removing
> <context:annotation-config/>", it works. My webapp
> loaded the wrong spring-context.xml.
> 
> Thanks,
> 
> --- On Sat, 11/21/09, Christian Schneider <ch...@die-schneider.net>
> wrote:
> 
> > From: Christian Schneider <ch...@die-schneider.net>
> > Subject: Re: CXF & Camel & Spring &
> ActiveMQ Integration Problems
> > To: users@cxf.apache.org
> > Date: Saturday, November 21, 2009, 8:35 AM
> > Hmm,
> > 
> > after looking closer at your context there was no
> > annotation config. But the stacktrace still seems to
> point
> > to the CommonAnnotationBeanPostProcessor. Are you sure
> the
> > context you posted is complete?
> > If yes it seems spring is configured in some other way
> to
> > interpret annotations. Are you using junit 4 tests
> > somewhere?
> > 
> > Greetings
> > 
> > Christian
> > 
> > 
> > Christian Schneider schrieb:
> > > 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
> > > 
> > > 
> > 
> > -- 
> > Christian Schneider
> > ---
> > http://www.liquid-reality.de
> > 
> > 
> 
> 
>       
> 


      

Re: CXF & Camel & Spring & ActiveMQ Integration Problems

Posted by Coder One <co...@yahoo.com>.
You are right.  After removing <context:annotation-config/>", it works. My webapp loaded the wrong spring-context.xml.

Thanks,

--- On Sat, 11/21/09, Christian Schneider <ch...@die-schneider.net> wrote:

> From: Christian Schneider <ch...@die-schneider.net>
> Subject: Re: CXF & Camel & Spring & ActiveMQ Integration Problems
> To: users@cxf.apache.org
> Date: Saturday, November 21, 2009, 8:35 AM
> Hmm,
> 
> after looking closer at your context there was no
> annotation config. But the stacktrace still seems to point
> to the CommonAnnotationBeanPostProcessor. Are you sure the
> context you posted is complete?
> If yes it seems spring is configured in some other way to
> interpret annotations. Are you using junit 4 tests
> somewhere?
> 
> Greetings
> 
> Christian
> 
> 
> Christian Schneider schrieb:
> > 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
> > 
> > 
> 
> -- 
> Christian Schneider
> ---
> http://www.liquid-reality.de
> 
> 


      

Re: CXF & Camel & Spring & ActiveMQ Integration Problems

Posted by Christian Schneider <ch...@die-schneider.net>.
Hmm,

after looking closer at your context there was no annotation config. But 
the stacktrace still seems to point to the 
CommonAnnotationBeanPostProcessor. Are you sure the context you posted 
is complete?
If yes it seems spring is configured in some other way to interpret 
annotations. Are you using junit 4 tests somewhere?

Greetings

Christian


Christian Schneider schrieb:
> 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
>
>

-- 

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


Re: CXF & Camel & Spring & ActiveMQ Integration Problems

Posted by Christian Schneider <ch...@die-schneider.net>.
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