尝试使用 jaxws-service 公开服务时出现 Mule3 问题
首先,我使用 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/Document;Ljava/lang/String;)Lorg/apache/ws/commons/schema/XmlSchema;
mule-module-cxf 看起来有问题。也许 XmlSchema 的版本不相关?
In first I generated CXF service using the WSDL to Java tool from CXF or the Maven plugin and then trying to expose service via mule 3 using cxf jaxws-service like so:
<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>
And in the end I constantly get the following exception:
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
I use mule 3.2.1. So mule-module-cxf is 3.2.1 as well.
I tried to specify wsdl location but nothing happened still got the same exception...
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;
It looks like something wrong with mule-module-cxf. Maybe version of XmlSchema is irrelevant?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎在类路径上使用了错误版本的
xmlschema
,请确保您的%MULE_HOME% 中有文件
并且您的类路径中没有其他XmlSchema-1.4.7.jar
/lib/optxmlschema-core
版本。It seems you are using an incorrect version of
xmlschema
on your classpath, please ensure that you have the fileXmlSchema-1.4.7.jar
in your%MULE_HOME%/lib/opt
and also that you don't have otherxmlschema-core
version in your classpath.