骡母连接器 - 无效的密钥类型/消息负载的类型为String(Mule Box Connector

2019-11-02 22:22发布

我试着写一个使用盒连接器的骡子流。 我能去http://localhost:8081/auth和成功授权。 但只要我创造我的盒子帐户,我收到了文件“未能调用getEvents消息负载的类型为:。字符串” 而在根异常跟踪我得到:“无效的密钥类型”

骡子流量(基于: https://github.com/mulesoft/box-connector/blob/master/demo/src/main/app/box-connector-demo.xml )

    <?xml version="1.0" encoding="UTF-8"?>

    <mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
        xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:box="http://www.mulesoft.org/schema/mule/box" 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" version="CE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/scripting         http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
    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/objectstore http://www.mulesoft.org/schema/mule/objectstore/1.0/mule-objectstore.xsd
    http://www.mulesoft.org/schema/mule/box http://www.mulesoft.org/schema/mule/box/2.0/mule-box.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
    http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
        <box:config name="Box" clientId="removed" clientSecret="removed" doc:name="Box">
            <box:oauth-callback-config domain="localhost" localPort="8081" path="callback" remotePort="8081"/>
        </box:config>
<objectstore:config name="ObjectStore" objectStore-ref="_defaultInMemoryObjectStore" doc:name="ObjectStore"/>
        <flow name="Authorize" doc:name="Authorize">
            <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP" path="auth"/>
            <box:authorize config-ref="Box" doc:name="Authorize" />

</flow>
    <flow name="longPolling" doc:name="longPolling">
            <box:listen-events config-ref="Box" doc:name="Box (Streaming)"/>
            <set-variable variableName="defaultValue" value="0" doc:name="Variable"/>
           <objectstore:retrieve config-ref="ObjectStore" key="streamPosition" defaultValue-ref="#[flowVars['defaultValue']]" doc:name="ObjectStore"/>
            <box:get-events config-ref="Box" streamPosition="#[payload]" accessTokenId="#[message.inboundProperties['boxAccessTokenId']]" doc:name="Box" />
            <objectstore:store config-ref="ObjectStore" key="streamPosition" value-ref="#[payload.nextStreamPosition]" overwrite="true" doc:name="ObjectStore"/>
            <scripting:transformer doc:name="Groovy">
        <scripting:script engine="Groovy"><![CDATA[return payload.entries.findAll{it.eventType =='ITEM_DOWNLOAD' || it.eventType == 'ITEM_PREVIEW'}
            ]]></scripting:script>
            </scripting:transformer>

    <scripting:transformer doc:name="Groovy">
                <scripting:script engine="Groovy"><![CDATA[return payload.findAll{it.source?.type == "file" && it.source?.parent.id == "0"}
            ]]></scripting:script>
            </scripting:transformer>

    <foreach doc:name="Foreach">
                <logger message="Box user #[payload.createdBy.login] has seen the file #[payload.source.name]" level="ERROR" doc:name="Logger"/>
            </foreach>


     </flow>
    </mule>

以下是完整的错误:

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    + Started app 'boxtest'                                    +
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    WARN  2014-02-06 10:00:35,607 [Box Long Polling thread for endpont http://2.realtime.services.box.net/subscribe?channel=removed&stream_type=all] org.mule.DefaultMuleMessage: setProperty(key, value) called with null value; removing key: boxAccessTokenId; please report the following stack trace to dev@mule.codehaus.org
    java.lang.Throwable
        at org.mule.DefaultMuleMessage.setProperty(DefaultMuleMessage.java:457)
        at org.mule.DefaultMuleMessage.addProperties(DefaultMuleMessage.java:1249)
        at org.mule.DefaultMuleMessage.<init>(DefaultMuleMessage.java:174)
        at org.mule.modules.box.processors.AbstractListeningMessageProcessor.process(AbstractListeningMessageProcessor.java:76)
        at org.mule.modules.box.lp.LongPollingClient$1.run(LongPollingClient.java:63)
        at java.lang.Thread.run(Unknown Source)
    ERROR 2014-02-06 10:00:35,823 [[boxtest].longPolling.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
    ********************************************************************************
    Message               : Failed to invoke getEvents. Message payload is of type: String
    Code                  : MULE_ERROR--2
    --------------------------------------------------------------------------------
    Exception stack is:
    1. Invalid key type (java.lang.RuntimeException)
      org.mule.modules.box.oauth.BoxConnectorOAuthClientFactory:28 (null)
    2. Failed to invoke getEvents. Message payload is of type: String (org.mule.api.MessagingException)
      org.mule.modules.box.processors.GetEventsMessageProcessor:155 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
    --------------------------------------------------------------------------------
    Root Exception stack trace:
    java.lang.RuntimeException: Invalid key type
        at org.mule.modules.box.oauth.BoxConnectorOAuthClientFactory.makeObject(BoxConnectorOAuthClientFactory.java:28)
        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1179)
        at org.mule.modules.box.oauth.BoxConnectorOAuthManager.acquireAccessToken(BoxConnectorOAuthManager.java:339)
        + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
    ********************************************************************************

Answer 1:

这看起来像一个bug对我说:框:让事件应该使用属性boxAccessTokenId作为认证令牌,有一个警告,财产不会因设置为空值,当我在看的BoxConnector源代码类,其中的值是从哪里来的,存在要被从未设置一个专用变量accessTokenIdentifier的参考。 我这一情况报告给骡子开发地址。



文章来源: Mule Box Connector - Invalid Key Type / Message payload is of type String