无法调用updateStatus。消息有效内容的类型为:String

时间:2014-01-27 14:04:22

标签: mule esb mule-studio

我刚开始使用Mule我正在使用twitter

创建一个非常简单的示例

我正在使用mule 3.5我开始创建New Example Project,然后创建Hello world

现在我正在使用twitter,当我使用show user我得到Json对象时,每件事看起来都没问题,但当我update status时,我收到此错误消息:

 Failed to invoke updateStatus. Message payload is of type: String

这是我的XML

<flow name="TwitterUserID" doc:name="TwitterUserID">
    <http:inbound-endpoint exchange-pattern="request-response"
        host="localhost" port="8081" doc:name="HTTP"
        doc:description="This endpoint receives an HTTP message." />
    <object-to-string-transformer doc:name="Object to String"/>
    <twitter:update-status config-ref="Twitter" doc:name="Twitter" status="This is from
        Mule "/>
    <json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>

错误

Root Exception stack trace:
twitter4j.internal.org.json.JSONException: JSONObject["text"] not found.
at twitter4j.internal.org.json.JSONObject.get(JSONObject.java:395)
at twitter4j.internal.org.json.JSONObject.getString(JSONObject.java:509)
at twitter4j.internal.json.StatusJSONImpl.init(StatusJSONImpl.java:166)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

WARN  2014-01-27 08:57:13,406 [[hello-world].connector.http.mule.default.receiver.02] 
org.apache.commons.httpclient.HttpMethodDirector: Unable to respond to any of these 
  challenges: {oauth=OAuth realm="https://api.twitter.com"}
ERROR 2014-01-27 08:57:13,409 [[hello-world].connector.http.mule.default.receiver.02] 
org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor.     
Root Exception was: JSONObject["text"] not found.. Type: class 
twitter4j.internal.org.json.JSONException

ERROR 2014-01-27 08:57:13,412 [[hello-world].connector.http.mule.default.receiver.02] 
org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Failed to invoke updateStatus. Message payload is of type:
  String

Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. JSONObject["text"] not found. (twitter4j.internal.org.json.JSONException)
  twitter4j.internal.org.json.JSONObject:395 (null)
2. JSONObject["text"] not found. (twitter4j.TwitterException)
  twitter4j.internal.json.StatusJSONImpl:172 (null)
3. Failed to invoke updateStatus. Message payload is of type: String   
(org.mule.api.MessagingException)

  org.mule.twitter.processors.UpdateStatusMessageProcessor:175 

--------------------------------------------------------------------------------
Root Exception stack trace:
twitter4j.internal.org.json.JSONException: JSONObject["text"] not found.
at twitter4j.internal.org.json.JSONObject.get(JSONObject.java:395)
at twitter4j.internal.org.json.JSONObject.getString(JSONObject.java:509)
at twitter4j.internal.json.StatusJSONImpl.init(StatusJSONImpl.java:166)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

1 个答案:

答案 0 :(得分:1)

问题是我需要更改读取和写入Twitter应用程序的权限

  1. 转到申请页面
  2. 设置
  3. 检查:
  4. enter image description here