I'm developing an application in which I need to consume data from a webservice.
This application runs on a Karaf container and uses Spring.
I had the wsdl files and used JAX-WS to generate the sources from the wsdl. If I launch a JUnit test in which I use the services, everything works fine, but when launching the app on the Karaf container, the following error appears:
Caugth exception of type javax.xml.ws.WebServiceException with message org.apache.cxf.service.factory.ServiceConstructionException
javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:345)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:334)
at javax.xml.ws.Service.getPort(Service.java:46)[:2.3.xxxxxxx]
at es.repartoxxxxxxxclient.view.webservice.pedido.PedidoService_Service.getPedidoService(PedidoService_Service.java:77)
at es.repartoxxxxxxxclient.view.webservice.pedido.PedidoService_Service$getPedidoService.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at es.xxxxxxx.devices.deliveries.EWhereDevice.getClient(EWhereDevice.groovy:66)
at es.xxxxxxx.devices.deliveries.DeliveriesProcessor$getClient.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at es.xxxxxxx.devices.deliveries.DeliveriesDevice.getClient(DeliveriesDevice.groovy:79)
at es.xxxxxxx.devices.deliveries.DeliveriesProcessor$getClient.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at es.xxxxxxx.devices.deliveries.PedidosDeviceService.getClient(PedidosDeviceService.groovy:36)
at org.xxxxxxx.devices.service.DeliveriesDeviceService$getClient.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at org.xxxxxxx.business.deliveries.impl.DeliveriesServiceImpl.getClient(DeliveriesServiceImpl.groovy:88)
at org.xxxxxxx.business.deliveries.DeliveriesService$getClient.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at VIEW.DatosClientePedidosView$_closure1.doCall(DatosClientePedidosView.groovy:240)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_07]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_07]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_07]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_07]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1047)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
at groovy.lang.Closure.call(Closure.java:412)[68:groovy-all:1.8.6]
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:51)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:82)
at $Proxy204.keyPressed(Unknown Source)
at java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:250)[:1.7.0_07]
at java.awt.Component.processKeyEvent(Component.java:6463)[:1.7.0_07]
at javax.swing.JComponent.processKeyEvent(JComponent.java:2829)[:1.7.0_07]
at java.awt.Component.processEvent(Component.java:6282)[:1.7.0_07]
at java.awt.Container.processEvent(Container.java:2229)[:1.7.0_07]
at java.awt.Component.dispatchEventImpl(Component.java:4861)[:1.7.0_07]
at java.awt.Container.dispatchEventImpl(Container.java:2287)[:1.7.0_07]
at java.awt.Component.dispatchEvent(Component.java:4687)[:1.7.0_07]
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895)[:1.7.0_07]
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762)[:1.7.0_07]
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027)[:1.7.0_07]
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899)[:1.7.0_07]
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727)[:1.7.0_07]
at java.awt.Component.dispatchEventImpl(Component.java:4731)[:1.7.0_07]
at java.awt.Container.dispatchEventImpl(Container.java:2287)[:1.7.0_07]
at java.awt.Window.dispatchEventImpl(Window.java:2719)[:1.7.0_07]
at java.awt.Component.dispatchEvent(Component.java:4687)[:1.7.0_07]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)[:1.7.0_07]
at java.awt.EventQueue.access$200(EventQueue.java:103)[:1.7.0_07]
at java.awt.EventQueue$3.run(EventQueue.java:682)[:1.7.0_07]
at java.awt.EventQueue$3.run(EventQueue.java:680)[:1.7.0_07]
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_07]
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)[:1.7.0_07]
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)[:1.7.0_07]
at java.awt.EventQueue$4.run(EventQueue.java:696)[:1.7.0_07]
at java.awt.EventQueue$4.run(EventQueue.java:694)[:1.7.0_07]
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_07]
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)[:1.7.0_07]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)[:1.7.0_07]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)[:1.7.0_07]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)[:1.7.0_07]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:155)[:1.7.0_07]
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)[:1.7.0_07]
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)[:1.7.0_07]
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_07]
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)[:1.7.0_07]
at java.awt.Dialog.show(Dialog.java:1077)[:1.7.0_07]
at java.awt.Component.show(Component.java:1651)[:1.7.0_07]
at java.awt.Component.setVisible(Component.java:1603)[:1.7.0_07]
at java.awt.Window.setVisible(Window.java:1014)[:1.7.0_07]
at java.awt.Dialog.setVisible(Dialog.java:1003)[:1.7.0_07]
at java_awt_Dialog$setVisible.call(Unknown Source)
at org.xxxxxxx.views.core.impl.WorkbenchImpl$_showViewAsDialog_closure1.doCall(WorkbenchImpl.groovy:381)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_07]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_07]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_07]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_07]
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:226)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.xxxxxxx.views.core.impl.WorkbenchImpl$_showViewAsDialog_closure1.doCall(WorkbenchImpl.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_07]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_07]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_07]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_07]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1047)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
at groovy.lang.Closure.call(Closure.java:412)[68:groovy-all:1.8.6]
at groovy.lang.Closure.call(Closure.java:406)[68:groovy-all:1.8.6]
at groovy.lang.Closure.run(Closure.java:490)[68:groovy-all:1.8.6]
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241)[:1.7.0_07]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)[:1.7.0_07]
at java.awt.EventQueue.access$200(EventQueue.java:103)[:1.7.0_07]
at java.awt.EventQueue$3.run(EventQueue.java:682)[:1.7.0_07]
at java.awt.EventQueue$3.run(EventQueue.java:680)[:1.7.0_07]
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_07]
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)[:1.7.0_07]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)[:1.7.0_07]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)[:1.7.0_07]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)[:1.7.0_07]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)[:1.7.0_07]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)[:1.7.0_07]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)[:1.7.0_07]
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)[:1.7.0_07]
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:98)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:476)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:343)
... 118 more
Caused by: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/wsdl/soap/ registered.
at org.apache.cxf.bus.managers.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:123)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:116)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)
... 122 more
Long history short, binding factory for http://schemas.xmlsoap.org/wsdl/soap/
is not available.
The difference between launching with JUnit and Karaf is that being Spring present, SpringBeanLocator
is instanced and so it removes SoapBindingFactory
extension from the BindingFactoryManager
, so when it goes to requested, it's not present.
I also have conf.xml
under src/main/resources/META-INF/spring/
folder with the following content:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath*:META-INF/cxf/cxf.xml"/>
<import resource="classpath*:META-INF/cxf/cxf-extension-soap.xml"/>
<import resource="classpath*:META-INF/cxf/cxf-servlet.xml"/>
</beans>
And the only dependency I'm using is:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.7.8</version>
</dependency>
Which also brings these:
\- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.7.8:compile
[INFO] | +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] | +- asm:asm:jar:3.3.1:compile
[INFO] | +- org.apache.cxf:cxf-api:jar:2.7.8:compile
[INFO] | | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.2.0:compile
[INFO] | | | \- org.codehaus.woodstox:stax2-api:jar:3.1.1:compile
[INFO] | | +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.3:compile
[INFO] | | +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] | | \- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] | +- org.apache.cxf:cxf-rt-core:jar:2.7.8:compile
[INFO] | | \- com.sun.xml.bind:jaxb-impl:jar:2.2.6:compile
[INFO] | +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.7.8:compile
[INFO] | | \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.7.8:compile
[INFO] | +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.7.8:compile
[INFO] | +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.7.8:compile
[INFO] | +- org.apache.cxf:cxf-rt-transports-http:jar:2.7.8:compile
[INFO] | \- org.apache.cxf:cxf-rt-ws-addr:jar:2.7.8:compile
[INFO] | \- org.apache.cxf:cxf-rt-ws-policy:jar:2.7.8:compile
[INFO] | \- org.apache.neethi:neethi:jar:3.0.2:compile
Any way of either deactivating the 'SpringBeanLocator` so it doesn't remove the binding factory from the manager, or to configure it correctly so it actually works?