Hi,

I do use activator to publish the endpoint. 
Thread 
.currentThread 
().setContextClassLoader(this.getClass().getClassLoader()); do help it get
rid of the exception. But I still can not see any soap messages in SMX logs.

Here is the bundle-context.xml 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"; 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
        
xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"; 
           xmlns:ctx="http://www.springframework.org/schema/context"; 
           xmlns:http="http://servicemix.apache.org/http/1.0";
           xmlns:cxf="http://cxf.apache.org/core";
           xmlns:jaxws="http://cxf.apache.org/jaxws";
        
xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"; 

           xsi:schemaLocation="http://www.springframework.org/schema/beans 
                                                
http://www.springframework.org/schema/beans/spring-beans.xsd 
                                                
http://www.springframework.org/schema/osgi 
                                                
http://www.springframework.org/schema/osgi/spring-osgi.xsd 
                                                
http://www.springframework.org/schema/osgi-compendium 
                                                
http://www.springframework.org/schema/osgi-compendium.xsd 
                                                
http://www.springframework.org/schema/context 
                                                
http://www.springframework.org/schema/context/spring-context.xsd
                                                   http://servicemix.apache.
org/http/1.0 
                                                   http://servicemix.apache.
org/http/1.0/servicemix-http.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/http-jetty/configuration
                                                
http://cxf.apache.org/schemas/configuration/http-jetty.xsd";>
 
  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"
/>
         
  
  
  <bean id="logInbound"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
  <bean id="logOutbound"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
  
  <cxf:bus>
        <cxf:inInterceptors>
            <ref bean="logInbound"/>
        </cxf:inInterceptors>
        <cxf:outInterceptors>
            <ref bean="logOutbound"/>
        </cxf:outInterceptors>        
    </cxf:bus>    
  
   
</beans>


But in the SMX logs, I can see this error when the bundles start.

05:21:16,970 | INFO  | xtenderThread-16 | ResourceInjector                 |
ommon.injection.ResourceInjector  170 |  -  -  | RESOURCE_RESOLVE_FAILED

This is related to the injector. Any idea?

Thanks,
Hao


-----Original Message-----
From: Freeman Fang [mailto:[email protected]] 
Sent: Thursday, June 09, 2011 7:50 PM
To: [email protected]
Subject: Re: Soap messages in SMX log

Hi,

Seems you publish the endpoint in bundle activator,  one potential  
issue is that the TCCL(thread context classloader) in activator start  
method isn't the expected one, which cause the resource inside bundle  
couldn't be loaded, you could try to add
Thread 
.currentThread 
().setContextClassLoader(this.getClass().getClassLoader());
at beginning of your bundle activator method to see if it helps.

Why you need use code to publish endpoint?
The preferred way is use spring-dm configuration to publish the cxf  
endpoint,  just like we do in cxf-osgi example shipped with kit.

Freeman
On 2011-6-9, at 下午9:55, Hao Ding wrote:

> Same issue with exception:
>
> 06:50:48,500 | WARN  | Thread-7         |  
> BusApplicationContext            |
> ache.cxf.common.logging.LogUtils  369 |  -  -  | Failed to load
> configuration META-INF/spring/bundle-context.xml
> 06:50:48,500 | WARN  | Thread-7         |  
> SpringBusFactory                 |
> ache.cxf.common.logging.LogUtils  369 |  -  -  | Failed to create
> application context.
> org.springframework.context.ApplicationContextException: Failed to  
> load
> configuration META-INF/spring/bundle-context.xml
>        at
> org 
> .apache 
> .cxf.bus.spring.BusApplicationContext.getConfigResources(BusApplic
> ationContext.java:152)
>        at
> org 
> .springframework 
> .context.support.AbstractXmlApplicationContext.loadBeanDe
> finitions(AbstractXmlApplicationContext.java:120)
>        at
> org 
> .apache 
> .cxf.bus.spring.BusApplicationContext.loadBeanDefinitions(BusAppli
> cationContext.java:262)
>        at
> org 
> .springframework 
> .context.support.AbstractRefreshableApplicationContext.re
> freshBeanFactory(AbstractRefreshableApplicationContext.java:130)
>        at
> org 
> .springframework 
> .context.support.AbstractApplicationContext.obtainFreshBe
> anFactory(AbstractApplicationContext.java:467)
>        at
> org 
> .springframework 
> .context.support.AbstractApplicationContext.refresh(Abstr
> actApplicationContext.java:397)
>        at
> org 
> .apache 
> .cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext
> .java:91)
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBu
> sFactory.java:110)
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:9
> 3)
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:8
> 8)
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:6
> 4)
>        at
> com 
> .ooma 
> .vm.subscriber_web_service.DCSubscriberActivator.start(DCSubscriberA
> ctivator.java:33)
>        at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl 
> $1.run(BundleConte
> xtImpl.java:783)[osgi-3.6.0.v20100517.jar:]
>        at java.security.AccessController.doPrivileged(Native
> Method)[:1.6.0_0]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.BundleContextImpl.startActivator(Bu
> ndleContextImpl.java:774)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.BundleContextImpl.start(BundleConte
> xtImpl.java:755)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.BundleHost.startWorker(BundleHost.j
> ava:370)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.AbstractBundle.start(AbstractBundle
> .java:284)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.AbstractBundle.start(AbstractBundle
> .java:276)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .apache 
> .karaf.features.internal.FeaturesServiceImpl.installFeatures(Featu
> resServiceImpl.java:350)[8:org.apache.karaf.features.core: 
> 2.0.0.fuse-01-00]
>        at
> org.apache.karaf.features.internal.FeaturesServiceImpl 
> $1.run(FeaturesService
> Impl.java:765)[8:org.apache.karaf.features.core:2.0.0.fuse-01-00]
> 06:50:48,500 | INFO  | xtenderThread-13 |  
> XmlBeanDefinitionReader          |
> tory.xml.XmlBeanDefinitionReader  315 | 138 -  
> org.springframework.beans - 3.
> 0.3.RELEASE | Loading XML bean definitions from OSGi
> resource[classpath:META-INF/cxf/cxf-extension-http-jetty.xml| 
> bnd.id=165|bnd.
> sym=com.ooma.vm.provisioning-web-service]
> 06:50:48,507 | ERROR | Thread-7         |  
> FeaturesServiceImpl              |
> s.internal.FeaturesServiceImpl$1  767 | 8 -  
> org.apache.karaf.features.core -
> 2.0.0.fuse-01-00 | Error installing boot features
> java.lang.Exception: Could not start bundle
> file:/opt/osgi/subscriber-web-service-1.0.jar in feature(s) :  
> Exception in
> com.ooma.vm.subscriber_web_service.DCSubscriberActivator.start() of  
> bundle
> com.ooma.vm.subscriber-web-service.
>        at
> org 
> .apache 
> .karaf.features.internal.FeaturesServiceImpl.installFeatures(Featu
> resServiceImpl.java:311)[8:org.apache.karaf.features.core: 
> 2.0.0.fuse-01-00]
>        at
> org.apache.karaf.features.internal.FeaturesServiceImpl 
> $1.run(FeaturesService
> Impl.java:765)[8:org.apache.karaf.features.core:2.0.0.fuse-01-00]
> Caused by: org.osgi.framework.BundleException: Exception in
> com.ooma.vm.subscriber_web_service.DCSubscriberActivator.start() of  
> bundle
> com.ooma.vm.subscriber-web-service.
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.BundleContextImpl.startActivator(Bu
> ndleContextImpl.java:806)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.BundleContextImpl.start(BundleConte
> xtImpl.java:755)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.BundleHost.startWorker(BundleHost.j
> ava:370)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.AbstractBundle.start(AbstractBundle
> .java:284)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.AbstractBundle.start(AbstractBundle
> .java:276)[osgi-3.6.0.v20100517.jar:]
>        at
> org 
> .apache 
> .karaf.features.internal.FeaturesServiceImpl.installFeatures(Featu
> resServiceImpl.java:303)[8:org.apache.karaf.features.core: 
> 2.0.0.fuse-01-00]
>        ... 1 more
> Caused by: java.lang.RuntimeException:
> org.springframework.context.ApplicationContextException: Failed to  
> load
> configuration META-INF/spring/bundle-context.xml
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:9
> 6)
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:8
> 8)
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:6
> 4)
>        at
> com 
> .ooma 
> .vm.subscriber_web_service.DCSubscriberActivator.start(DCSubscriberA
> ctivator.java:33)
>        at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl 
> $1.run(BundleConte
> xtImpl.java:783)[osgi-3.6.0.v20100517.jar:]
>        at java.security.AccessController.doPrivileged(Native
> Method)[:1.6.0_0]
>        at
> org 
> .eclipse 
> .osgi.framework.internal.core.BundleContextImpl.startActivator(Bu
> ndleContextImpl.java:774)[osgi-3.6.0.v20100517.jar:]
>        ... 6 more
> Caused by: org.springframework.context.ApplicationContextException:  
> Failed
> to load configuration META-INF/spring/bundle-context.xml
>        at
> org 
> .apache 
> .cxf.bus.spring.BusApplicationContext.getConfigResources(BusApplic
> ationContext.java:152)
>        at
> org 
> .springframework 
> .context.support.AbstractXmlApplicationContext.loadBeanDe
> finitions(AbstractXmlApplicationContext.java:120)
>        at
> org 
> .apache 
> .cxf.bus.spring.BusApplicationContext.loadBeanDefinitions(BusAppli
> cationContext.java:262)
>        at
> org 
> .springframework 
> .context.support.AbstractRefreshableApplicationContext.re
> freshBeanFactory(AbstractRefreshableApplicationContext.java:130)
>        at
> org 
> .springframework 
> .context.support.AbstractApplicationContext.obtainFreshBe
> anFactory(AbstractApplicationContext.java:467)
>        at
> org 
> .springframework 
> .context.support.AbstractApplicationContext.refresh(Abstr
> actApplicationContext.java:397)
>        at
> org 
> .apache 
> .cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext
> .java:91)
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBu
> sFactory.java:110)
>        at
> org 
> .apache 
> .cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:9
> 3)
>        ... 12 more
>
>
> -----Original Message-----
> From: Freeman Fang [mailto:[email protected]]
> Sent: Thursday, June 09, 2011 9:46 AM
> To: [email protected]
> Subject: Re: Soap messages in SMX log
>
> Hi,
>
> Try with "META-INF/spring/bundle-context.xml"
>
> Freeman
>
> On 2011-6-9, at 下午9:29, Hao Ding wrote:
>
>> Hi Freeman,
>>
>> My project is mvn eclipse project. "your_bus_configure.xml" is file
>> "src/main/resources/META-INF/spring/bundle-context.xml".
>>
>> I tried, it throw the exception. With full path and without path
>>
>> Without path exception:
>> Caused by: org.springframework.context.ApplicationContextException:
>> Failed
>> to load configuration bundle-context.xml
>>
>> With full path exception:
>> Caused by: org.springframework.context.ApplicationContextException:
>> Failed
>> to load configuration src/main/resources/META-INF/spring/bundle-
>> context.xml
>>
>>
>> How to specify it in
>> Bus bus = factory.createBus(
>>            "your_bus_configure.xml"
>>        );
>>
>>
>> Thanks,
>> Hao
>>
>> -----Original Message-----
>> From: Freeman Fang [mailto:[email protected]]
>> Sent: Thursday, June 09, 2011 8:57 AM
>> To: [email protected]
>> Subject: Re: Soap messages in SMX log
>>
>> Hi,
>>
>> Before your code you need add
>>        SpringBusFactory factory = new SpringBusFactory();
>>        Bus bus = factory.createBus(
>>            "your_bus_configure.xml"
>>        );
>>        BusFactory.setDefaultBus(bus);
>>
>> to pick up the cxf bus you configured.
>>
>> Freeman
>> On 2011-6-9, at 下午8:33, Hao Ding wrote:
>>
>>> Hi Freeman,
>>>
>>> I use java code to publish the cxf endpoint. In spring
>>> configuration, I only
>>> put the following in.
>>>
>>> <httpj:engine-factory bus="cxf">
>>>    <httpj:engine port="8080">
>>>       <httpj:sessionSupport>true</httpj:sessionSupport>
>>>    </httpj:engine>
>>> </httpj:engine-factory>
>>>
>>>
>>> In java code, I publish the endpoint like this.
>>>
>>> MyServiceImpl implementor = new MyServiceImpl();
>>> endpt = Endpoint.create(implementor);
>>> endpt.publish("http://localhost:8080/axis/services/MyService";);
>>>
>>> Thanks,
>>> Hao
>>>
>>> -----Original Message-----
>>> From: Freeman Fang [mailto:[email protected]]
>>> Sent: Wednesday, June 08, 2011 8:42 PM
>>> To: [email protected]
>>> Subject: Re: Soap messages in SMX log
>>>
>>> Hi,
>>>
>>> Could you elaborate how you publish cxf endpoint with spring
>>> configuration logging way?
>>> You use java code or also use spring to publish the cxf endpoint?
>>>
>>> Freeman
>>>
>>> On 2011-6-9, at 上午3:01, Hao Ding wrote:
>>>
>>>> By the way, I have the followings in the spring config file as  
>>>> well.
>>>> Maybe
>>>> they have the effect on soap logging?
>>>> <import resource="classpath:META-INF/cxf/cxf.xml" />
>>>> <import resource="classpath:META-INF/cxf/cxf-extension-http-
>>>> jetty.xml" />
>>>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>>>> <import resource="classpath:META-INF/cxf/cxf-extension-http-
>>>> binding.xml" />
>>>>
>>>> -----Original Message-----
>>>> From: Hao Ding [mailto:[email protected]]
>>>> Sent: Wednesday, June 08, 2011 2:49 PM
>>>> To: [email protected]
>>>> Subject: Soap messages in SMX log
>>>>
>>>> Hi SMX users,
>>>>
>>>> I'd like to see the soap messages in SMX logs. Based on the Apache
>>>> CXF docs,
>>>> I put the following in the spring config files.
>>>>
>>>> xmlns:cxf="http://cxf.apache.org/core";
>>>>   xsi:schemaLocation="
>>>> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>>>> http://www.springframework.org/schema/beans
>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>>>>
>>>> <bean id="logInbound"
>>>> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>>> <bean id="logOutbound"
>>>> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>>>
>>>> <cxf:bus>
>>>>     <cxf:inInterceptors>
>>>>         <ref bean="logInbound"/>
>>>>     </cxf:inInterceptors>
>>>>     <cxf:outInterceptors>
>>>>         <ref bean="logOutbound"/>
>>>>     </cxf:outInterceptors>
>>>> </cxf:bus>
>>>>
>>>> Then I compiled and run SMX, do the curl test, I did not see the
>>>> soap
>>>> messages in the logs.
>>>>
>>>> If using java code to do the configuration, like
>>>>
>>>> import javax.xml.ws.Endpoint;
>>>> import org.apache.cxf.interceptor.LoggingInInterceptor;
>>>> import org.apache.cxf.interceptor.LoggingOutInterceptor;
>>>> import org.apache.cxf.jaxws.EndpointImpl;
>>>>
>>>> Object implementor = new GreeterImpl();
>>>> EndpointImpl ep = (EndpointImpl)
>>>> Endpoint.publish("http://localhost/service";, implementor);
>>>>
>>>> ep.getServiceFactory().getBus().getInInterceptors().add(new
>>>> LoggingInInterceptor());
>>>> ep.getServiceFactory().getBus().getOutInterceptors().add(new
>>>> LoggingOutInterceptor());
>>>>
>>>> Then I can see the soap messages in the logs.
>>>>
>>>> I'd like to know what can cause the spring configuration not taking
>>>> effect.
>>>>
>>>>
>>>> Thanks,
>>>> Hao
>>>>
>>>
>>> ---------------------------------------------
>>> Freeman Fang
>>>
>>> FuseSource
>>> Email:[email protected]
>>> Web: fusesource.com
>>> Twitter: freemanfang
>>> Blog: http://freemanfang.blogspot.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------
>> Freeman Fang
>>
>> FuseSource
>> Email:[email protected]
>> Web: fusesource.com
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> ---------------------------------------------
> Freeman Fang
>
> FuseSource
> Email:[email protected]
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
>
>
>
>
>
>
>
>
>
>

---------------------------------------------
Freeman Fang

FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Reply via email to