Pregunta

i just started with Mule i was creating a very simple example using twitter

i'm using mule 3.5 i started with creating New Example Project then the Hello world

now i'm using twitter and every thing looks okay when i use show user i get the Json object but when i do update status i get this error message :

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

Here is my 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>

Error

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)

¿Fue útil?

Solución

The issue was i needed to change the permission to read and write to the twitter application

  1. go to application page
  2. Settings
  3. check :

enter image description here

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top