Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法从文本单元格Mule Dataweave获取数值_Mule_Mule Component_Dataweave - Fatal编程技术网

无法从文本单元格Mule Dataweave获取数值

无法从文本单元格Mule Dataweave获取数值,mule,mule-component,dataweave,Mule,Mule Component,Dataweave,我正在使用File connector读取数据,并使用data weave将数据转换为application/java。如果excel中有任何单元格的类型为Accounting,则会出现此异常: 消息:无法从文本单元格获取数值(java.lang.IllegalStateException)。 有效载荷:com.mulesoft.weave.reader。DefaultSeekableStream@6fe3727f 如果单元格格式更改为“常规”,则异常消失。我如何才能在excel中使用记帐类型的

我正在使用File connector读取数据,并使用data weave将数据转换为application/java。如果excel中有任何单元格的类型为Accounting,则会出现此异常:

消息:无法从文本单元格获取数值(java.lang.IllegalStateException)。 有效载荷:com.mulesoft.weave.reader。DefaultSeekableStream@6fe3727f


如果单元格格式更改为“常规”,则异常消失。我如何才能在excel中使用记帐类型的单元格?

我在本地anypoint studio中创建了相同的场景,最初使用studio版本6.2.3,Mule runtime 3.8.1 EE遇到了几个问题。我将运行时更新为3.8.3ee,所有问题都解决了&一切似乎都很正常。验证是否存在任何版本问题,excel支持最近添加到dataweave中,并且仍处于测试阶段

这是对我有用的流程

                <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
        xmlns:spring="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-current.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
    http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
    http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
        <flow name="xslxreaderFlow">
            <file:inbound-endpoint path="C:\files\input" responseTimeout="10000"  doc:name="File"/>
            <dw:transform-message doc:name="Transform Message" metadata:id="aa47f058-609d-4d96-9646-a52accacaf9f">
                <dw:input-payload doc:sample="sample_data\excel_1.xlsx" mimeType="application/xlsx"/>
                <dw:set-payload><![CDATA[%dw 1.0
    %output application/java
    ---

    payload."Sheet1" map ((sheet1 , indexOfSheet1) -> { 
       id: sheet1.ID, 
       amount:sheet1.Amount
    })]]></dw:set-payload>
            </dw:transform-message>
            <logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
        </flow>
    </mule>
这是您的文件的日志消息

INFO  2017-04-06 09:37:38,650 [[test].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\files\input\file1.xlsx
INFO  2017-04-06 09:37:38,792 [[test].xslxreaderFlow.stage1.03] org.mule.api.processor.LoggerMessageProcessor: [{id=1234, amount=500.5}, {id=456, amount=700.25}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}]

请提供导致异常%dw 1.0%output application/java---payload.“Sheet1”映射((Sheet1,indexOfSheet1)->{id:Sheet1.id})的excel文档和dataweave。您是否使用了我附加为输入源的excel?我使用的是3.8.3 EE运行时版本。我的流程可以成功读取excel文件,但无法读取我附加的文件。这是因为“金额”字段的数据类型。如果单击“格式单元格”,您将看到它是记帐。如果我把它改为“一般”,一切都很好。如果excel输入源中有任何会计格式的字段,我如何才能使其正常工作?我从google drive下载了您的文件,运行起来似乎很好,但它也会生成空白单元格。我将日志消息添加到我的答案中。当然,flow正在读取文件,并且在拾取后将其删除,因为我没有将autoDelete设置为false。文件名模式是可选的参数,在我添加到流之后仍然像往常一样运行。请告诉我任何问题。您没有看到前两个有效项“{id=1234,amount=500.5},{id=456,amount=700.25}”。铰孔数据为空单元格,因为您的文件有问题。抱歉,我看不到前两项
                <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
        xmlns:spring="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-current.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
    http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
    http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
        <flow name="xslxreaderFlow">
            <file:inbound-endpoint path="C:\files\input" responseTimeout="10000"  doc:name="File"/>
            <dw:transform-message doc:name="Transform Message" metadata:id="aa47f058-609d-4d96-9646-a52accacaf9f">
                <dw:input-payload doc:sample="sample_data\excel_1.xlsx" mimeType="application/xlsx"/>
                <dw:set-payload><![CDATA[%dw 1.0
    %output application/java
    ---

    payload."Sheet1" map ((sheet1 , indexOfSheet1) -> { 
       id: sheet1.ID, 
       amount:sheet1.Amount
    })]]></dw:set-payload>
            </dw:transform-message>
            <logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
        </flow>
    </mule>
INFO  2017-04-04 16:46:57,940 [[test].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\files\input\Book1.xlsx
INFO  2017-04-04 16:47:00,719 [[test].xslxreaderFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: [{id=123456, amount=5000.75}, {id=234567, amount=45367.34}]
INFO  2017-04-06 09:37:38,650 [[test].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\files\input\file1.xlsx
INFO  2017-04-06 09:37:38,792 [[test].xslxreaderFlow.stage1.03] org.mule.api.processor.LoggerMessageProcessor: [{id=1234, amount=500.5}, {id=456, amount=700.25}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}, {id=, amount=}]