camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S. Ali Tokmen" <savas-ali.tok...@bull.net>
Subject Re: Definining interceptors in camel-cxf
Date Wed, 21 Jan 2009 08:34:43 GMT
Hello

I think I've found the real cause of this problem:

   1. At line 81, the WSDL Service Factory does a:
      definition =
      getBus().getExtension(WSDLManager.class).getDefinition(url);
   2. The "bus" we have there is the one defined in our beans.xml file,
      therefore a CXFBusImpl
   3. The "extensions" field of that bus only has one
      BusApplicationContext and no WSDLManager
   4. Therefore, the getExtension returns null

To fix it, I think we need to spring-import the CXF extensions. 
http://www.nabble.com/Need-clarification-on-cxf-servlet.xml-config-file.-td19598828.html 
tells me there's a cxf-all.xml import that improts everything.

I'll keep you updated

S. Ali Tokmen
savas-ali.tokmen@bull.net

Office: +33 4 76 29 76 19
GSM:    +33 66 43 00 555

Bull, Architect of an Open World TM
http://www.bull.com



S. Ali Tokmen a écrit :
> Hello
>
> I also have this impression :) I've tried with a simpler, CXF-only 
> example, and it still does the exact same exception!
>
> The only thing I do it to add the following in the beans.xml file:
>
>    <!-- !!! Enabling this results in a NPE !!! -->
>    <cxf:bus>
>      <cxf:outInterceptors>
>        <ref bean="LoggingOutInterceptor"/>
>      </cxf:outInterceptors>
>    </cxf:bus -->
>
> I'm pretty sure I'm forgetting something, just cannot see what.
>
> All source codes are available on the following SVNs:
>
>    
> svn://svn.forge.objectweb.org/svnroot/jonas/sandbox/wss-propagation-parent 
>
>    revision 16259 for the CXF-only version
>    svn://svn.forge.objectweb.org/svnroot/jonas/sandbox/camel-jonas4
>    revision 16258 for CXF + CAMEL
>
> Versions used are CAMEL 1.5.0 and CXF 2.1.3.
>
> Cheers
>
> S. Ali Tokmen
> savas-ali.tokmen@bull.net
>
> Office: +33 4 76 29 76 19
> GSM:    +33 66 43 00 555
>
> Bull, Architect of an Open World TM
> http://www.bull.com
>
>
>
> Willem Jiang a écrit :
>> Hi,
>>
>> Can you send me your test case, and which version of camel are you 
>> using?
>> It's looks like a cxfEndpoint configuration issue.
>>
>> Willem
>> S. Ali Tokmen wrote:
>>  
>>>  Hello again
>>>
>>> I now have a very annoying exception:
>>>
>>>    java.lang.NullPointerException
>>>           at
>>>   
>>> org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:81)

>>>
>>>           at
>>>   
>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:311)

>>>
>>>
>>>           at
>>>   
>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:408)

>>>
>>>
>>>           at
>>>   
>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:189)

>>>
>>>
>>>           at
>>>   
>>> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)

>>>
>>>
>>>           at
>>>   
>>> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52) 
>>>
>>>           at
>>>   
>>> org.apache.camel.component.cxf.CxfProducer.createClientFromClientFactoryBean(CxfProducer.java:161)

>>>
>>>
>>>           at
>>>    
>>> org.apache.camel.component.cxf.CxfProducer.<init>(CxfProducer.java:68)
>>>           at
>>>   
>>> org.apache.camel.component.cxf.CxfEndpoint.createProducer(CxfEndpoint.java:74)

>>>
>>>
>>>           at
>>>    
>>> org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:84)
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64) 
>>>
>>>           at
>>>   
>>> org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:249)

>>>
>>>
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64) 
>>>
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:45)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64) 
>>>
>>>           at
>>>   
>>> org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:249)

>>>
>>>
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53) 
>>>
>>>           at
>>>   
>>> org.apache.camel.processor.DelegateProcessor.doStart(DelegateProcessor.java:68)

>>>
>>>
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53) 
>>>
>>>           at
>>>   
>>> org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:54)

>>>
>>>
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
>>>           at
>>>    
>>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53) 
>>>
>>>           at
>>>    
>>> org.apache.camel.impl.DefaultConsumer.doStart(DefaultConsumer.java:85)
>>>           at
>>>    org.apache.camel.component.jms.JmsConsumer.doStart(JmsConsumer.java)
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>           at
>>>   
>>> org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:421)

>>>
>>>
>>>           at
>>>   
>>> org.apache.camel.impl.DefaultCamelContext.startRoutes(DefaultCamelContext.java:659)

>>>
>>>
>>>           at
>>>   
>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:632)

>>>
>>>
>>>           at
>>>   
>>> org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:167)

>>>
>>>
>>>           at
>>>   
>>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:162)

>>>
>>>
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>           at
>>>   
>>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:97)

>>>
>>>
>>>           at
>>>   
>>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:116)

>>>
>>>
>>>           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:275)

>>>
>>>
>>>           at
>>>   
>>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:737)

>>>
>>>
>>>           at
>>>   
>>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:384)

>>>
>>>
>>>           at
>>>   
>>> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

>>>
>>>
>>>           at
>>>   
>>> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)

>>>
>>>
>>>           at
>>>   
>>> org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:189) 
>>>
>>>           at org.apache.camel.spring.Main.doStart(Main.java:152)
>>>           at
>>>    org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>           at
>>>   
>>> org.ow2.jonas.camel.server.CamelWrapper$CamelThread.run(CamelWrapper.java:156)

>>>
>>>
>>>           ... 1 more
>>>
>>> Anyone has any idea? I'll start debugging CXF shortly, now waiting for
>>> package downloads.
>>>
>>> Thanks
>>>
>>> S. Ali Tokmen
>>> savas-ali.tokmen@bull.net
>>>
>>> Office: +33 4 76 29 76 19
>>> GSM:    +33 66 43 00 555
>>>
>>> Bull, Architect of an Open World TM
>>> http://www.bull.com
>>>
>>>
>>>
>>> Willem Jiang a écrit :
>>>    
>>>> Please try the last verion of Camel 1.5.1-snapshot or Camel 
>>>> 2.0-snapshot.
>>>> I just fixed some bus related issue in camel-cxf component.
>>>>
>>>> Willem
>>>>
>>>> S. Ali Tokmen wrote:
>>>>  
>>>>      
>>>>> Hello, Willem
>>>>>
>>>>> The cxf:bus approach would be exactly what I need, but when I 
>>>>> enable it
>>>>> I have the impression Camel-CXF ignores all of it. Did you try out
>>>>> anything similar?
>>>>>
>>>>> Thanks
>>>>>
>>>>> S. Ali Tokmen
>>>>> savas-ali.tokmen@bull.net
>>>>>
>>>>> Office: +33 4 76 29 76 19
>>>>> GSM:    +33 66 43 00 555
>>>>>
>>>>> Bull, Architect of an Open World TM
>>>>> http://www.bull.com
>>>>>
>>>>>
>>>>>
>>>>> Willem Jiang a écrit :
>>>>>           
>>>>>> Hi
>>>>>>
>>>>>> You can set the interceptors into cxf bus[1], then all the CXF
>>>>>> endpoints
>>>>>> create by CAMEL will use them.
>>>>>> [1]http://cwiki.apache.org/CXF20DOC/bus-configuration.html
>>>>>>
>>>>>> Willem
>>>>>>
>>>>>> S. Ali Tokmen wrote:
>>>>>>  
>>>>>>               
>>>>>>> Hello, Pawel
>>>>>>>
>>>>>>> Thank you for this quick response. I now have another issue:
I 
>>>>>>> would
>>>>>>> actually be interested in defining these properties globally,

>>>>>>> i.e. for
>>>>>>> all CXF endpoints created by CAMEL. This way, people programming

>>>>>>> the
>>>>>>> routes would only use CXF URLs and not create the CXF beans by

>>>>>>> hand.
>>>>>>>
>>>>>>> Thank you
>>>>>>>
>>>>>>> S. Ali Tokmen
>>>>>>> savas-ali.tokmen@bull.net
>>>>>>>
>>>>>>> Office: +33 4 76 29 76 19
>>>>>>> GSM:    +33 66 43 00 555
>>>>>>>
>>>>>>> Bull, Architect of an Open World TM
>>>>>>> http://www.bull.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Pawel Jasinski a écrit :
>>>>>>>                      
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> here is a snipped from the camel-context where wss4j is defined
as
>>>>>>>> interceptor:
>>>>>>>>
>>>>>>>>   <cxf:cxfEndpoint id="consumerEndpoint"
>>>>>>>>     address="http://localhost:9001/SoapContext/SoapPort/consumer"
>>>>>>>>     wsdlURL="wsdl/consumer/consumer.wsdl"
>>>>>>>>     serviceClass="org.example.consumer.Consumer"
>>>>>>>>     endpointName="s:consumerSOAP"
>>>>>>>>     serviceName="s:consumer"
>>>>>>>>     xmlns:s="http://www.example.org/consumer/">
>>>>>>>>
>>>>>>>>     <cxf:inInterceptors>
>>>>>>>>     <!-- request consumer => esb -->
>>>>>>>>       <bean
>>>>>>>> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
>>>>>>>>         <constructor-arg>
>>>>>>>>           <map>
>>>>>>>>             <entry key="action" value="SAMLTokenUnsigned
Timestamp
>>>>>>>> Signature Encrypt" />
>>>>>>>>
>>>>>>>>             <!-- signature -->
>>>>>>>>             <entry key="user" value="" />
>>>>>>>>
>>>>>>>>             <!-- alias from the keystore to decrypt message
-->
>>>>>>>>             <entry key="signaturePropFile"
>>>>>>>> value="META-INF/identity.properties" />
>>>>>>>>
>>>>>>>>             <!-- encryption -->
>>>>>>>>             <entry key="decryptionPropFile"
>>>>>>>> value="META-INF/wss-bus.properties" />
>>>>>>>>             <entry key="passwordCallbackClass"
>>>>>>>> value="org.example.common.PasswordHandler" />
>>>>>>>>           </map>
>>>>>>>>         </constructor-arg>
>>>>>>>>       </bean>
>>>>>>>>       <bean class="org.example.common.SAMLInterceptor">
>>>>>>>>       </bean>
>>>>>>>>     </cxf:inInterceptors>
>>>>>>>>     <cxf:outInterceptors>
>>>>>>>>      ....
>>>>>>>>
>>>>>>>>     </cxf:outInterceptors>
>>>>>>>> </cxf:cxfEndpoint>
>>>>>>>>
>>>>>>>> I hope this helps.
>>>>>>>> -- Pawel
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Jan 19, 2009 at 4:12 PM, S. Ali Tokmen
>>>>>>>> <savas-ali.tokmen@bull.net> wrote:
>>>>>>>>  
>>>>>>>>                            
>>>>>>>>> Hello
>>>>>>>>>
>>>>>>>>> In CXF, one can define a serioes of interceptors, inbound
and
>>>>>>>>> outbound, for
>>>>>>>>> doing many actions. Our implementation defines some Processor
>>>>>>>>> interceptors
>>>>>>>>> for handling security-related tasks (namely, serializing
and
>>>>>>>>> deserializing
>>>>>>>>> Security Contexts).
>>>>>>>>>
>>>>>>>>> In CXF-Spring, this is done using the jaxws:inInterceptors
tag in
>>>>>>>>> the
>>>>>>>>> jaxws:endpoint definition.
>>>>>>>>>
>>>>>>>>> Now, I would like to integrate this mechanism into CAMEL...

>>>>>>>>> And the
>>>>>>>>> question
>>>>>>>>> is: how can we define CXF interceptors in CAMEL? Programmatic
>>>>>>>>> definition
>>>>>>>>> works perfectly for me -if CAMEL for example defines
a default 
>>>>>>>>> CXF
>>>>>>>>> bus for
>>>>>>>>> itself, getting a reference to it and adding my interceptors

>>>>>>>>> for all
>>>>>>>>> camel-cxf endpoints would be great.
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>>
>>>>>>>>> S. Ali Tokmen
>>>>>>>>> savas-ali.tokmen@bull.net
>>>>>>>>>
>>>>>>>>> Office: +33 4 76 29 76 19
>>>>>>>>> GSM:    +33 66 43 00 555
>>>>>>>>>
>>>>>>>>> Bull, Architect of an Open World TM
>>>>>>>>> http://www.bull.com                 
>>
>>
>>
>>
>>   
>


Mime
View raw message