So I am having an issue getting the right Service Factory.

Clearing out the karaf/data/cache directory and then doing a fresh deploy of 
the Bundle works fine.  

However after restarting Karaf the org.apache.cxf.jaxws.JaxWsServerFactoryBean 
is not used by the CxfEndpoint.  Instead the 
org.apache.cxf.frontend.ServerFactoryBean is used.  This causes the mapping of 
WSDL Operations to SEI methods to not work.

This results in error messages:


2015-12-15 09:51:18,729 | WARN  | xtenderThread-42 | 
ReflectionServiceFactoryBean     | 194 - org.apache.cxf.cxf-rt-core - 2.7.11 | 
No method was found for the WSDL operation <%WSDL Operation%>


It also causes the CXF page to not list the WSDL Operations under the SOAP 
Port.  

The reason this is happening is because the annotations that are on the SEI 
class are proxied.  This causes the annotation check in 
org.apache.camel.component.cxf.CxfSpringEndpoint.createServerFactoryBean() to 
seem as if the SEI does not have the javax.jws.WebService annotation.  The 
annotation is on the list of annotations for the SEI, but they are proxied by 
sun.reflect.annotation.AnnotationInvocationHandler.



My work around (one I don’t like) is to:

* Remove the serviceClass attribute of the <cxf:Endpoint>
* Set the Data Format of the endpoint to: PAYLOAD
* Use a JaxBFormat to take the raw XML to the POJO.

The reason this work is that Camel is forcing the use of JaxWsServerFactoryBean 
when there is no SEI defined and the Dataformat is PAYLOAD.

Thanks,

Joe Kampf






On 12/16/15, 9:29 AM, "Claus Ibsen" <claus.ib...@gmail.com> wrote:

>That was a mistake in the camel cxf documentation - i am removing
>that. Also that other xml file is not in use in an unit test and its
>being removed as well.
>
>You dont need to set that service factory when using camel-cxf. Just
>remove it from your code.
>
>
>
>On Wed, Dec 16, 2015 at 1:21 PM, Joseph Kampf <joseph.ka...@gmail.com> wrote:
>> I am trying to specify the ServiceFactory used by my CXF Endpoint.
>>
>> <cxf:cxfEndpoint id="cxfBeanFromEndpoint"
>> address="${esbservices.proxy.baseurl}/path"
>> serviceClass="MyPortClass"
>> endpointName="s:completePort" serviceName="s:aria_complete_api"
>> wsdlURL="MyWsdl.wsdl"
>> xmlns:s="myNamespace">
>> <cxf:inInterceptors>
>> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
>> </cxf:inInterceptors>
>> <cxf:outInterceptors>
>> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
>> </cxf:outInterceptors>
>> <cxf:serviceFactory>
>> <bean class="org.apache.cxf.jaxws.JaxWsServerFactoryBean" />
>> </cxf:serviceFactory>
>> </cxf:cxfEndpoint>
>>
>> However I am getting the following error:
>>
>> karaf@root()> Exception in thread "SpringOsgiExtenderThread-50" 
>> org.apache.camel.RuntimeCamelException: 
>> org.apache.camel.FailedToCreateRouteException: Failed to create route 
>> aria.esbservices.complete.soap.proxy: 
>> Route(aria.esbservices.complete.soap.proxy)[[From[cxf:bean:a... because of 
>> Failed to resolve endpoint: cxf://bean:cxfBeanFromEndpoint due to: Cannot 
>> lookup: cxfBeanFromEndpoint from registry: 
>> org.apache.camel.spring.spi.ApplicationContextRegistry@51cb33dc with 
>> expected type: class org.apache.camel.component.cxf.CxfEndpoint due: Error 
>> creating bean with name 'cxfBeanFromEndpoint': Error setting property 
>> values; nested exception is 
>> org.springframework.beans.NotWritablePropertyException: Invalid property 
>> 'serviceFactory' of bean class 
>> [org.apache.camel.component.cxf.CxfSpringEndpoint]: Bean property 
>> 'serviceFactory' is not writable or has an invalid setter method. Does the 
>> parameter type of the setter match the return type of the getter?
>> at 
>> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1363)
>> at 
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:122)
>> at 
>> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:318)
>> at 
>> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96)
>> at 
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
>> at 
>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
>> at 
>> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
>> at 
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
>> at 
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>> at 
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
>> at 
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
>> at java.lang.Thread.run(Thread.java:745)
>> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create 
>> route aria.esbservices.complete.soap.proxy: 
>> Route(aria.esbservices.complete.soap.proxy)[[From[cxf:bean:a... because of 
>> Failed to resolve endpoint: cxf://bean:cxfBeanFromEndpoint due to: Cannot 
>> lookup: cxfBeanFromEndpoint from registry: 
>> org.apache.camel.spring.spi.ApplicationContextRegistry@51cb33dc with 
>> expected type: class org.apache.camel.component.cxf.CxfEndpoint due: Error 
>> creating bean with name 'cxfBeanFromEndpoint': Error setting property 
>> values; nested exception is 
>> org.springframework.beans.NotWritablePropertyException: Invalid property 
>> 'serviceFactory' of bean class 
>> [org.apache.camel.component.cxf.CxfSpringEndpoint]: Bean property 
>> 'serviceFactory' is not writable or has an invalid setter method. Does the 
>> parameter type of the setter match the return type of the getter?
>> at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:180)
>> at 
>> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:780)
>> at 
>> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2068)
>> at 
>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1816)
>> at 
>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1683)
>> at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
>> at 
>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1651)
>> at 
>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:254)
>> at 
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)
>> ... 10 more
>> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to 
>> resolve endpoint: cxf://bean:cxfBeanFromEndpoint due to: Cannot lookup: 
>> cxfBeanFromEndpoint from registry: 
>> org.apache.camel.spring.spi.ApplicationContextRegistry@51cb33dc with 
>> expected type: class org.apache.camel.component.cxf.CxfEndpoint due: Error 
>> creating bean with name 'cxfBeanFromEndpoint': Error setting property 
>> values; nested exception is 
>> org.springframework.beans.NotWritablePropertyException: Invalid property 
>> 'serviceFactory' of bean class 
>> [org.apache.camel.component.cxf.CxfSpringEndpoint]: Bean property 
>> 'serviceFactory' is not writable or has an invalid setter method. Does the 
>> parameter type of the setter match the return type of the getter?
>> at 
>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:534)
>> at 
>> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:71)
>> at 
>> org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:190)
>> at 
>> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:106)
>> at 
>> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112)
>> at 
>> org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
>> at 
>> org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)
>> at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:888)
>> at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:175)
>> ... 18 more
>> Caused by: org.apache.camel.NoSuchBeanException: Cannot lookup: 
>> cxfBeanFromEndpoint from registry: 
>> org.apache.camel.spring.spi.ApplicationContextRegistry@51cb33dc with 
>> expected type: class org.apache.camel.component.cxf.CxfEndpoint due: Error 
>> creating bean with name 'cxfBeanFromEndpoint': Error setting property 
>> values; nested exception is 
>> org.springframework.beans.NotWritablePropertyException: Invalid property 
>> 'serviceFactory' of bean class 
>> [org.apache.camel.component.cxf.CxfSpringEndpoint]: Bean property 
>> 'serviceFactory' is not writable or has an invalid setter method. Does the 
>> parameter type of the setter match the return type of the getter?
>> at 
>> org.apache.camel.impl.CompositeRegistry.lookupByNameAndType(CompositeRegistry.java:62)
>> at 
>> org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByNameAndType(PropertyPlaceholderDelegateRegistry.java:63)
>> at 
>> org.apache.camel.util.CamelContextHelper.lookup(CamelContextHelper.java:129)
>> at 
>> org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:149)
>> at 
>> org.apache.camel.component.cxf.CxfComponent.createEndpoint(CxfComponent.java:70)
>> at 
>> org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:123)
>> at 
>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:514)
>> ... 26 more
>> Caused by: org.springframework.beans.factory.BeanCreationException: Error 
>> creating bean with name 'cxfBeanFromEndpoint': Error setting property 
>> values; nested exception is 
>> org.springframework.beans.NotWritablePropertyException: Invalid property 
>> 'serviceFactory' of bean class 
>> [org.apache.camel.component.cxf.CxfSpringEndpoint]: Bean property 
>> 'serviceFactory' is not writable or has an invalid setter method. Does the 
>> parameter type of the setter match the return type of the getter?
>> at 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1455)
>> at 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
>> at 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>> at 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
>> at 
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:312)
>> at 
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
>> at 
>> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1123)
>> at 
>> org.apache.camel.spring.spi.ApplicationContextRegistry.lookupByNameAndType(ApplicationContextRegistry.java:47)
>> at 
>> org.apache.camel.impl.CompositeRegistry.lookupByNameAndType(CompositeRegistry.java:56)
>> ... 32 more
>> Caused by: org.springframework.beans.NotWritablePropertyException: Invalid 
>> property 'serviceFactory' of bean class 
>> [org.apache.camel.component.cxf.CxfSpringEndpoint]: Bean property 
>> 'serviceFactory' is not writable or has an invalid setter method. Does the 
>> parameter type of the setter match the return type of the getter?
>> at 
>> org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1044)
>> at 
>> org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:904)
>> at 
>> org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
>> at 
>> org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
>> at 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1452)
>> ... 40 more
>>
>> According to the documentation at :  http://camel.apache.org/cxf   I should 
>> be able to specify this.
>>
>> I also found this XML in the Camel-cxf test/resources directory:  
>> GreeterEndpointsForProducer.xml  However I can’t seem to find a unit test 
>> that uses it.
>>
>>
>>
>>
>
>
>
>-- 
>Claus Ibsen
>-----------------
>http://davsclaus.com @davsclaus
>Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to