我几乎没有从 WSO2 ESB 开始,需要创建一个方案,允许我从通过 VFS(已启用)获得的 .edi 文件(96a)将其转换为 XML ......为此,我正在使用 Smooks 和UN / EDIFACT 执行解析。执行时会出现以下错误 WSO2:
[2014-01-16 08:16:44,684] ERROR - VFSTransportListener Error processing File URI : file:///home/pwcenter/Proxy_UnEdifact/in/wm_msg_download_xml_tipo_7.edi
org.milyn.cdr.SmooksConfigurationException: Error invoking @Initialize method 'initialize' on class 'org.milyn.smooks.edi.ModelLoader'.
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:457)
at org.milyn.cdr.annotation.Configurator.initialise(Configurator.java:439)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:91)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:66)
at org.milyn.delivery.JavaContentHandlerFactory.create(JavaContentHandlerFactory.java:63)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.addCDU(ContentDeliveryConfigBuilder.java:623)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyCDUStrategy(ContentDeliveryConfigBuilder.java:548)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyStrategy(ContentDeliveryConfigBuilder.java:536)
at org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.iterate(ContentDeliveryConfigBuilder.java:711)
at org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.access$300(ContentDeliveryConfigBuilder.java:690)
at org.milyn.delivery.ContentDeliveryConfigBuilder.extractContentHandlers(ContentDeliveryConfigBuilder.java:484)
at org.milyn.delivery.ContentDeliveryConfigBuilder.load(ContentDeliveryConfigBuilder.java:349)
at org.milyn.delivery.ContentDeliveryConfigBuilder.getConfig(ContentDeliveryConfigBuilder.java:146)
at org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:91)
at org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:65)
at org.milyn.Smooks.createExecutionContext(Smooks.java:411)
at org.milyn.Smooks.createExecutionContext(Smooks.java:374)
at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:103)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.axis2.transport.base.AbstractTransportListener.handleIncomingMessage(AbstractTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.processFile(VFSTransportListener.java:597)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:158)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:107)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.milyn.edisax.EDIConfigurationException: Failed to locate jar file for EDI Mapping Model URN 'org.milyn.edi.unedifact:d96a-mapping:*'. Jar must be available on classpath.
at org.milyn.edisax.util.EDIUtils.getMappingModelConfigStream(EDIUtils.java:300)
at org.milyn.edisax.util.EDIUtils.getMappingModelList(EDIUtils.java:207)
at org.milyn.edisax.util.EDIUtils.loadMappingModels(EDIUtils.java:118)
at org.milyn.smooks.edi.ModelLoader.initialize(ModelLoader.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:453)
... 32 more
Smooks的配置是:
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:unedifact="http://www.milyn.org/xsd/smooks/unedifact-1.4.xsd">
<unedifact:reader mappingModel="urn:org.milyn.edi.unedifact:d96a-mapping:*" />
</smooks-resource-list>
我在 Java 应用程序中使用过同样的配置,而且我工作得很好。
此外,除了创建 CLASSPATH 甚至 build-classpath-directory 命令之外,我还尝试在 WSO2 中的 dropins 和 lib 目录中手动添加依赖项,但没有成功。