syndesisio / connectors

Apache Camel Connectors for Syndesis
Apache License 2.0
6 stars 12 forks source link

Twitter mention error: "Method with name: null not found" #90

Open nicolaferraro opened 6 years ago

nicolaferraro commented 6 years ago

I'm doing a basic "twitter mention to salesforce contact record" demo on minishift (but the same happens on ignite cloud), mapping name to firstname and lastname (separate) and text to description.

The pod logs indicate the following error:


Message History
--
  | ---------------------------------------------------------------------------------------------------------------------------------------
  | RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
  | [flow1             ] [flow1             ] [twitter-mention-connector-component://MENTIONS?delay=30000&sinceId=1          ] [         1]
  | [flow1             ] [filter1           ] [filter[{io.syndesis.integration.runtime.util.JsonSimplePredicate@343e225a}]   ] [         0]
  |  
  | Stacktrace
  | ---------------------------------------------------------------------------------------------------------------------------------------
  | org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: null on null due to: org.apache.camel.component.bean.MethodNotFoundException: Method with name: null not found on bean: StatusJSONImpl{createdAt=Sat Oct 07 22:23:49 UTC 2017, id=_suppress_, text='__suppress__', source='<a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</a>', isTruncated=false, inReplyToStatusId=_suppress_, inReplyToUserId=_suppress_, isFavorited=false, isRetweeted=false, favoriteCount=1, inReplyToScreenName='_suppress_', geoLocation=null, place=null, retweetCount=0, isPossiblySensitive=false, lang='it', contributorsIDs=[], retweetedStatus=null, userMentionEntities=[UserMentionEntityJSONImpl{name='_suppress_', screenName='_suppress_', id=_suppress_}, UserMentionEntityJSONImpl{name='_suppress_', screenName='_suppress_', id=_suppress_}, UserMentionEntityJSONImpl{name='_suppress_', screenName='_suppress_', id=_suppress_}, UserMentionEntityJSONImpl{name='_suppress_', screenName='_suppress_', id=_suppress_}], urlEntities=[], hashtagEntities=[], mediaEntities=[], symbolEntities=[], currentUserRetweetId=-1, user=UserJSONImpl{id=_suppress_, name='_suppress_', email='null', screenName='_suppress_', location='_suppress_', description='_suppress_', isContributorsEnabled=false, profileImageUrl='_suppress_', profileImageUrlHttps='_suppress_', isDefaultProfileImage=false, url='_suppress_', isProtected=false, followersCount=315, status=null, profileBackgroundColor='131516', profileTextColor='333333', profileLinkColor='19CF86', profileSidebarFillColor='EFEFEF', profileSidebarBorderColor='EEEEEE', profileUseBackgroundImage=true, isDefaultProfile=false, showAllInlineMedia=f
  | alse, friendsCount=535, createdAt=Mon Dec 21 21:45:07 UTC 2009, favouritesCount=303, utcOffset=7200, timeZone='Rome', profileBackgroundImageUrl='_suppress_', profileBackgroundImageUrlHttps='_suppress_', profileBackgroundTiled=true, lang='en', statusesCount=2472, isGeoEnabled=true, isVerified=false, translator=false, listedCount=36, isFollowRequestSent=false, withheldInCountries=null}, withHeldInCountries=null, quotedStatusId=-1, quotedStatus=null} of type: twitter4j.StatusJSONImpl. Exchange[ID-twitter2salesforce-2-zfvzz-1507722069687-0-39]
  | at org.apache.camel.language.bean.BeanExpression.invokeOgnlMethod(BeanExpression.java:302)
  | at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)
  | at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:135)
  | at org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:126)
  | at org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:118)
  | at org.apache.camel.builder.ExpressionBuilder$40.evaluate(ExpressionBuilder.java:1004)
  | at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
  | at org.apache.camel.builder.BinaryPredicateSupport.matchesReturningFailureMessage(BinaryPredicateSupport.java:60)
  | at org.apache.camel.builder.BinaryPredicateSupport.matches(BinaryPredicateSupport.java:50)
  | at org.apache.camel.language.simple.ast.BinaryExpression$5.evaluate(BinaryExpression.java:235)
  | at org.apache.camel.util.ExpressionToPredicateAdapter.matches(ExpressionToPredicateAdapter.java:37)
  | at io.syndesis.integration.runtime.util.JsonSimplePredicate.matches(JsonSimplePredicate.java:56)
  | at org.apache.camel.processor.FilterProcessor.matches(FilterProcessor.java:65)
  | at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:51)
  | at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
  | at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
  | at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
  | at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110)
  | at org.apache.camel.component.connector.ConnectorConsumerProcessor.process(ConnectorConsumerProcessor.java:66)
  | at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
  | at org.apache.camel.component.twitter.consumer.DefaultTwitterConsumer.poll(DefaultTwitterConsumer.java:98)
  | at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
  | at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
  | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  | at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
  | at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
  | at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
  | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  | at java.lang.Thread.run(Thread.java:748)

I've _suppress_ed some info in the stack trace.

It does not seem related to specific data in my feed, since the method the connector wants to invoke is named null.

How is it possible to see the source, now that git has been removed?

zregvart commented 6 years ago

I've seen this one before but I can't for the life of me remember what the issue was, does this remind you of something @rhuss?

Could it be that the filter step generated a null name for the bean property? Something like ${body[]}?

nicolaferraro commented 6 years ago

I'm trying to dig into the syndesis codebase to find the cause, but yes, if I remove the filter and keep only the mapper, everything seems to work.

nicolaferraro commented 6 years ago

No, the problem was I didn't map the TwitterScreenName__c when I did the first test with filter..

rhuss commented 6 years ago

It boils down to this code snippet at https://github.com/rhuss/syndesis-integration-runtime/blob/8e91786461aae8d1fc33297fe9c56b2565ad9766/runtime/src/main/java/io/syndesis/integration/runtime/util/JsonSimplePredicate.java#L56 :

     return language.createPredicate(expression).matches(exchange);

But the exception looks like that it might be an issue of Camel itself, when the simple language applies the expression to the object in the exchange. Regardless how flawed the expression might be, the error should not happen during the introspection of the body's type class as it seems to look like here. Would be interesting how the filter looks like.

But wait, maybe the generated filter step uses a "null" path for the object extraction (as @zregvart suspects). @nicolaferraro how did you create the filter step ?