首先,我使用来自CXF或Maven插件的WSDL to Java工具生成CXF服务,然后尝试使用cxf jaxws-service通过mule 3公开服务,如下所示:
<flow name="SoakarService">
<!-- Public interface -->
<composite-source>
<inbound-endpoint address="http://localhost:8777/services/soakar" exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.arcusys.soakar.soap.Soakar"/>
</inbound-endpoint>
</composite-source>
<component>
<singleton-object class="com.arcusys.soakar.soap.SoakarImpl"/>
</component>
</flow>
最后我不断得到以下例外:
Exception in thread "main" org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "start" on object: Flow{SoakarService}
at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:236)
at org.mule.lifecycle.RegistryLifecycleManager$RegistryLifecycleCallback.onTransition(RegistryLifecycleManager.java:276)
at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:155)
at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:126)
at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:80)
at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:120)
at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:94)
at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:90)
at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:72)
at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:64)
at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:223)
at fi.arcusys.soakar.TestMuleServer.main(TestMuleServer.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.NoSuchMethodError: org.apache.cxf.common.xmlschema.SchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/String;)Lorg/apache/ws/commons/schema/XmlSchema;
at org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:177)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:398)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:444)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:682)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:507)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:157)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:202)
at org.mule.module.cxf.builder.AbstractInboundMessageProcessorBuilder.build(AbstractInboundMessageProcessorBuilder.java:202)
at org.mule.module.cxf.builder.AbstractInboundMessageProcessorBuilder.build(AbstractInboundMessageProcessorBuilder.java:61)
at org.mule.module.cxf.config.FlowConfiguringMessageProcessor.initialise(FlowConfiguringMessageProcessor.java:94)
at org.mule.processor.chain.AbstractMessageProcessorChain.initialise(AbstractMessageProcessorChain.java:79)
at org.mule.processor.chain.AbstractMessageProcessorChain.initialise(AbstractMessageProcessorChain.java:79)
at org.mule.endpoint.DefaultInboundEndpoint.createMessageProcessorChain(DefaultInboundEndpoint.java:159)
at org.mule.endpoint.AbstractEndpoint.getMessageProcessorChain(AbstractEndpoint.java:517)
at org.mule.endpoint.DefaultInboundEndpoint.start(DefaultInboundEndpoint.java:100)
at org.mule.source.StartableCompositeMessageSource.start(StartableCompositeMessageSource.java:150)
at org.mule.construct.AbstractFlowConstruct.startIfStartable(AbstractFlowConstruct.java:284)
at org.mule.construct.AbstractPipeline.doStart(AbstractPipeline.java:209)
at org.mule.construct.AbstractFlowConstruct$2.onTransition(AbstractFlowConstruct.java:120)
at org.mule.construct.AbstractFlowConstruct$2.onTransition(AbstractFlowConstruct.java:116)
at org.mule.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:141)
at org.mule.construct.FlowConstructLifecycleManager.fireStartPhase(FlowConstructLifecycleManager.java:95)
at org.mule.construct.AbstractFlowConstruct.start(AbstractFlowConstruct.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:225)
... 16 more
我使用mule 3.2.1。所以mule-module-cxf也是3.2.1。
我试图指定wsdl位置,但没有发生任何事情仍然有相同的异常......
引起:
java.lang.NoSuchMethodError: org.apache.cxf.common.xmlschema.SchemaCollection.read(Lorg / W3C / DOM /文件; Ljava /郎/字符串;)Lorg /阿帕奇/ WS /公地/模式/的XmlSchema;
mule-module-cxf看起来有点不对劲。也许XmlSchema的版本无关紧要?
答案 0 :(得分:0)
您的类路径上似乎使用了不正确的xmlschema
版本,请确保您XmlSchema-1.4.7.jar
中的文件%MULE_HOME%/lib/opt
以及您没有其他xmlschema-core
您的类路径中的{1}}版本。