WSO2没有捕获Smooks的异常

时间:2014-12-26 06:47:31

标签: wso2 wso2esb smooks

我正在使用WSO2 ESB 4.8.1,我使用Smooks 1.5来读取固定长度的文件,然后用原始XML解析它。它工作正常,但我还必须实现其特殊的流程。

问题:

问题是,如果我搞砸smooks配置文件,它会抛出一个异常,但它没有被WSO2捕获。对于所有其他错误和异常,WSO2启动故障序列,您可以在其中获取ERROR_MESSAGE,ERROR_DETAIL属性,但在这种情况下,它只是终止流并且服务不会进入故障序列。除非服务进入故障序列,否则我无法做任何事情。

示例文件:

John     Lock

我用来创建例外的Smooks-config文件:

<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
                      xmlns:fl="http://www.milyn.org/xsd/smooks/fixed-length-1.3.xsd">
  <fl:reader fields="FNAME[4],$ignore$[4],LNAME">
      </fl:reader>
</smooks-resource-list>

wso2日志文件中的异常:

org.milyn.cdr.SmooksConfigurationException: Error invoking @Initialize method 'initialize' on class 'org.milyn.fixedlength.FixedLengthReader'.
    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.mediators.base.SequenceMediator.mediate(SequenceMediator.java:196)
    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.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1911)
    at org.milyn.fixedlength.FixedLengthReader.buildFields(FixedLengthReader.java:455)
    at org.milyn.fixedlength.FixedLengthReader.initialize(FixedLengthReader.java:277)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:453)

注意: Smooks正在给出正确的例外,但我不明白的是为什么WSO2 esb服务没有进入故障序列并且刚刚终止......?这是smooks的一些行为吗??

1 个答案:

答案 0 :(得分:0)

我认为这是WSO2 ESB的预期行为。最近,我们正在开发项目,我们使用smooks使用VFS传输将固定长度数据转换为WSO2 ESB中的XML。我们遇到过同样的问题。在与WSO2官方支持联系后,我们发现它是WSO2 ESB的预期行为。当发生突触异常时,故障序列将仅执行。