That said, if it were possible to have a service interface injected with the 
help of Spring dm (as Dan suggested)
then there's a high chance it would work well.
In some of ServiceMix tests it's done by declaring a jaxws:client, for example 
(thanks to Freeman) :

http://svn.apache.org/repos/asf/servicemix/smx4/features/trunk/examples/itests/cxf-jms-osgi/src/main/resources/META-INF/spring/beans.xml

and then this client is accessed like this (http://svn.apache.org/repos/asf/servicemix/smx4/features/trunk/examples/itests/tests/src/test/java/org/apache/servicemix/examples/IntegrationTest.java) :

public void testJmsOsgi() throws Exception {
       Thread.sleep(5000);
       
waitOnContextCreation("org.apache.servicemix.examples.itests.cxf-jms-osgi");
       Thread.sleep(5000);

       ServiceReference ref = 
bundleContext.getServiceReference(HelloWorld.class.getName());
       assertNotNull("Service Reference is null", ref);

       org.apache.servicemix.examples.cxf.HelloWorld helloWorld = null;

       helloWorld = (org.apache.servicemix.examples.cxf.HelloWorld) 
bundleContext.getService(ref);
       ....
}

but I believe it can also be injected as a property like this :

void setClient(HelloWorld hw) {}

I just can't recall at the moment what else needs to be done for this injection to work, but it should be doable. Perhaps this setter should be present on the user bundle's BundleActivator class, with the bundle including the application context bean in META-INF/spring

cheers, Sergey


Hi,

I think the DOSGI DSW client runtime sets a thread context loader to the
one which loaded one of the CXF classes which is currently in scope, so
in this case it might be worth trying setting a context loader to

JaxWsProxyFactoryBean.class.getClassLoader()

it might help...

cheers, Sergey

-----Original Message-----
From: Daniel Kulp [mailto:[email protected]]
Sent: 26 October 2009 14:39
To: [email protected]
Cc: devaughn
Subject: Re: OSGi (Equinox) and CXF troubles


Couple questions:

1) Are you using the full CXF bundle jar that we provide?   Also, what
version?  2.2.4?

2) Are you using the spring dm stuff?   What does the META-
INF/spring/beans.xml   contain?


Dan



On Sat October 24 2009 1:10:09 pm devaughn wrote:
I am building an Eclipse 3.4 based RCP application and I need to
consume
some webservices and I am not concerned with DOSGi.  It seems that I
have
worked through the majority of the dependency issues I was having and
now I
am getting an exception that I am not sure how to get rid of.

Code: (nothing special here just following the example from

http://cxf.apache.org/docs/a-simple-jax-ws-service.html#AsimpleJAX-WSser
vic
e -Accessingyourservice)
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(e);        factory.setAddress(address);
        factory.create();

Exception:

org.osgi.framework.BundleException: Exception in
com.cisco.surf.sync.core.SyncCoreBundle.start() of bundle
com.cisco.surf.sync.core.    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivato
r(B
u ndleContextImpl.java:1028)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleC
ont
e xtImpl.java:984)    at

org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHo
st.
j ava:346)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:265)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:257)    at

org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start
(Fr
a meworkCommandProvider.java:257)    at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:3
9 )    at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Imp
l .java:25)    at java.lang.reflect.Method.invoke(Method.java:597)
at

org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.exe
cu
te (FrameworkCommandInterpreter.java:150)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(Fram
ewo
r kConsole.java:302)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Framew
ork
C onsole.java:287)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkC
ons
o le.java:223)    at java.lang.Thread.run(Thread.java:637) Caused by:
 org.apache.cxf.service.factory.ServiceConstructionException: Could
not
 resolve a binding for null    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingIn
fo(
A bstractWSDLBasedEndpointFactory.java:404)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointI
nfo
( AbstractWSDLBasedEndpointFactory.java:258)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(
Abs
t ractWSDLBasedEndpointFactory.java:146)    at

org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:
52)
at

org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactory
Bea
n .java:102)    at

org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.
jav
a

:115)    at


com.cisco.surf.sync.core.services.RemoteService.getServiceInstance(Remot
eSe
r vice.java:74)    at
com.cisco.surf.sync.core.SyncCoreBundle.start(SyncCoreBundle.java:28)
at

org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleC
ont
e xtImpl.java:1009)    at
 java.security.AccessController.doPrivileged(Native Method)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivato
r(B
u ndleContextImpl.java:1003)    ... 14 more Caused by:
org.apache.cxf.BusException: No binding factory for namespace
http://schemas.xmlsoap.org/soap/ registered.    at

org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(Bindi
ngF
a ctoryManagerImpl.java:91)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingIn
fo(
A bstractWSDLBasedEndpointFactory.java:394)    ... 24 more Nested
 Exception:
org.apache.cxf.service.factory.ServiceConstructionException:
 Could not resolve a binding for null    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingIn
fo(
A bstractWSDLBasedEndpointFactory.java:404)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointI
nfo
( AbstractWSDLBasedEndpointFactory.java:258)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(
Abs
t ractWSDLBasedEndpointFactory.java:146)    at

org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:
52)
at

org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactory
Bea
n .java:102)    at

org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.
jav
a

:115)    at


com.cisco.surf.sync.core.services.RemoteService.getServiceInstance(Remot
eSe
r vice.java:74)    at
com.cisco.surf.sync.core.SyncCoreBundle.start(SyncCoreBundle.java:28)
at

org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleC
ont
e xtImpl.java:1009)    at
 java.security.AccessController.doPrivileged(Native Method)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivato
r(B
u ndleContextImpl.java:1003)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleC
ont
e xtImpl.java:984)    at

org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHo
st.
j ava:346)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:265)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:257)    at

org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start
(Fr
a meworkCommandProvider.java:257)    at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:3
9 )    at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Imp
l .java:25)    at java.lang.reflect.Method.invoke(Method.java:597)
at

org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.exe
cu
te (FrameworkCommandInterpreter.java:150)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(Fram
ewo
r kConsole.java:302)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Framew
ork
C onsole.java:287)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkC
ons
o le.java:223)    at java.lang.Thread.run(Thread.java:637) Caused by:
 org.apache.cxf.BusException: No binding factory for namespace
http://schemas.xmlsoap.org/soap/ registered.    at

org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(Bindi
ngF
a ctoryManagerImpl.java:91)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingIn
fo(
A bstractWSDLBasedEndpointFactory.java:394)    ... 24 more Nested
 Exception: org.apache.cxf.BusException: No binding factory for
namespace
http://schemas.xmlsoap.org/soap/ registered.    at

org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(Bindi
ngF
a ctoryManagerImpl.java:91)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingIn
fo(
A bstractWSDLBasedEndpointFactory.java:394)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointI
nfo
( AbstractWSDLBasedEndpointFactory.java:258)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(
Abs
t ractWSDLBasedEndpointFactory.java:146)    at

org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:
52)
at

org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactory
Bea
n .java:102)    at

org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.
jav
a

:115)    at


com.cisco.surf.sync.core.services.RemoteService.getServiceInstance(Remot
eSe
r vice.java:74)    at
com.cisco.surf.sync.core.SyncCoreBundle.start(SyncCoreBundle.java:28)
at

org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleC
ont
e xtImpl.java:1009)    at
 java.security.AccessController.doPrivileged(Native Method)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivato
r(B
u ndleContextImpl.java:1003)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleC
ont
e xtImpl.java:984)    at

org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHo
st.
j ava:346)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:265)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:257)    at

org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start
(Fr
a meworkCommandProvider.java:257)    at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:3
9 )    at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Imp
l .java:25)    at java.lang.reflect.Method.invoke(Method.java:597)
at

org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.exe
cu
te (FrameworkCommandInterpreter.java:150)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(Fram
ewo
r kConsole.java:302)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Framew
ork
C onsole.java:287)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkC
ons
o le.java:223)    at java.lang.Thread.run(Thread.java:637) Nested
 Exception:
org.apache.cxf.service.factory.ServiceConstructionException:
 Could not resolve a binding for null    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingIn
fo(
A bstractWSDLBasedEndpointFactory.java:404)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointI
nfo
( AbstractWSDLBasedEndpointFactory.java:258)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(
Abs
t ractWSDLBasedEndpointFactory.java:146)    at

org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:
52)
at

org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactory
Bea
n .java:102)    at

org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.
jav
a

:115)    at


com.cisco.surf.sync.core.services.RemoteService.getServiceInstance(Remot
eSe
r vice.java:74)    at
com.cisco.surf.sync.core.SyncCoreBundle.start(SyncCoreBundle.java:28)
at

org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleC
ont
e xtImpl.java:1009)    at
 java.security.AccessController.doPrivileged(Native Method)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivato
r(B
u ndleContextImpl.java:1003)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleC
ont
e xtImpl.java:984)    at

org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHo
st.
j ava:346)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:265)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:257)    at

org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start
(Fr
a meworkCommandProvider.java:257)    at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:3
9 )    at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Imp
l .java:25)    at java.lang.reflect.Method.invoke(Method.java:597)
at

org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.exe
cu
te (FrameworkCommandInterpreter.java:150)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(Fram
ewo
r kConsole.java:302)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Framew
ork
C onsole.java:287)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkC
ons
o le.java:223)    at java.lang.Thread.run(Thread.java:637) Caused by:
 org.apache.cxf.BusException: No binding factory for namespace
http://schemas.xmlsoap.org/soap/ registered.    at

org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(Bindi
ngF
a ctoryManagerImpl.java:91)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingIn
fo(
A bstractWSDLBasedEndpointFactory.java:394)    ... 24 more Nested
 Exception: org.apache.cxf.BusException: No binding factory for
namespace
http://schemas.xmlsoap.org/soap/ registered.    at

org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(Bindi
ngF
a ctoryManagerImpl.java:91)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingIn
fo(
A bstractWSDLBasedEndpointFactory.java:394)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointI
nfo
( AbstractWSDLBasedEndpointFactory.java:258)    at

org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(
Abs
t ractWSDLBasedEndpointFactory.java:146)    at

org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:
52)
at

org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactory
Bea
n .java:102)    at

org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.
jav
a

:115)    at


com.cisco.surf.sync.core.services.RemoteService.getServiceInstance(Remot
eSe
r vice.java:74)    at
com.cisco.surf.sync.core.SyncCoreBundle.start(SyncCoreBundle.java:28)
at

org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleC
ont
e xtImpl.java:1009)    at
 java.security.AccessController.doPrivileged(Native Method)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivato
r(B
u ndleContextImpl.java:1003)    at

org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleC
ont
e xtImpl.java:984)    at

org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHo
st.
j ava:346)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:265)    at

org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBu
ndl
e .java:257)    at

org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start
(Fr
a meworkCommandProvider.java:257)    at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:3
9 )    at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Imp
l .java:25)    at java.lang.reflect.Method.invoke(Method.java:597)
at

org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.exe
cu
te (FrameworkCommandInterpreter.java:150)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(Fram
ewo
r kConsole.java:302)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Framew
ork
C onsole.java:287)    at

org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkC
ons
o le.java:223)    at java.lang.Thread.run(Thread.java:637)

Any help would be greatly appreciated!!!

Thanks,
Dennis


--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to