SoapBindingFactory在使用Spring的Karaf上使用Apache CXF时不存在(SoapBindingFactory not present using Apache CXF o

系统教程 行业动态 更新时间:2024-06-14 17:02:18
SoapBindingFactory在使用Spring的Karaf上使用Apache CXF时不存在(SoapBindingFactory not present using Apache CXF on Karaf with Spring)

我正在开发一个应用程序,我需要从Web服务中使用数据。

此应用程序在Karaf容器上运行并使用Spring。

我有wsdl文件并使用JAX-WS从wsdl生成源代码。 如果我启动我使用服务的JUnit测试,一切正常,但在Karaf容器上启动应用程序时,会出现以下错误:

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

http://schemas.xmlsoap.org/wsdl/soap/历史悠久,绑定工厂不可用。

使用JUnit和Karaf启动之间的区别在于Spring存在, SpringBeanLocator是实例化的,因此它从BindingFactoryManager删除了SoapBindingFactory扩展,因此当它转到请求时,它不存在。

我在src/main/resources/META-INF/spring/文件夹下也有conf.xml ,内容如下:

<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>

而我唯一使用的依赖是:

<dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>2.7.8</version> </dependency>

这也带来了这些:

\- 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

是否有任何方法可以停用'SpringBeanLocator`,因此它不会从管理器中删除绑定工厂,或者正确配置它以使其实际工作?

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?

最满意答案

为什么需要将CXF用于WS客户端? CXF是重量级工具,具有许多依赖性,可能会干扰您的aplication依赖树并导致问题,它更适合服务器端。

对于客户方,我建议您不要使用任何特殊的库。 对于存根生成,可以使用来自JDK的wsimport shell命令(或相应的maven插件)。 您必须使用的唯一依赖是:

<dependency> <groupId>com.sun.xml</groupId> <artifactId>com.springsource.com.sun.xml.messaging.saaj</artifactId> <version>${saaj.version}</version> </dependency>

您需要做的另一件事是com.sun.xml.internal.ws.client包的引导,该包通常不是由karaf的系统包提供的。

Why do you need to use CXF for a WS client? CXF is heavyweight tool with many dependencies that can interfere in your aplication dependency tree and cause problems, it's more suitable for server side.

For cliente side, I recomend you don't use any special library. For stub generation the wsimport shell command from the JDK can be used (or a corresponding maven plugin). And the only dependency you have to use is:

<dependency> <groupId>com.sun.xml</groupId> <artifactId>com.springsource.com.sun.xml.messaging.saaj</artifactId> <version>${saaj.version}</version> </dependency>

The other thing you have to do is the bootstrapping of the com.sun.xml.internal.ws.client package which is normally not provided by the system bundle of karaf.

更多推荐

本文发布于:2023-04-21 19:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/5f4e52f234e875eff10ef708d866cbe0.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   Karaf   Spring   SoapBindingFactory   present

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!