Flume Twitter data streaming setup issue - twitter

I'm geting following exception while extracting Twitter data using Flume on CDH4.
twitter4j.TwitterStreamImpl: Receiving status stream. Exception in
thread "Twitter4J Async Dispatcher[0]" java.lang.NoSuchMethodError:
twitter4j.json.JSONObjectType.determine(Ltwitter4j/internal/org/json/JSONObject;)Ltwitter4j/json/JSONObjectType;
at
twitter4j.AbstractStreamImplementation$1.run(AbstractStreamImplementation.java:100)
at
twitter4j.internal.async.ExecuteThread.run(DispatcherImpl.java:116)

I was getting the same issue in my code, but when I changed the .jar from twitter4j-core-2.2.6.jar to twitter4j-stream-3.0.0.jar it got resolved.
The main reason behind this issue was due to FilterQuery fq = new FilterQuery(); was used in the code and FilterQuery class is present in twitter4j-core-2.2.6.jar but it has some problem and due to this the issue was coming. If we replace the twitter4j-core-2.2.6.jar with twitter4j-stream-3.0.0.jar then it also contains FilterQuery class and issue gets solved.

Related

WorkFusion RPAExpress Exception Handling

I'm using Error Handling in WorkFusion.
Is there a way to see the error message in the catch block i.e. exception occurred block.
How about using:
<log>exception_msg_var</log>
or
println exception_msg_var
exporting exceptions to datastore?
To get the error message in RPA Express, you can keep the code outside of exception handling and then, the software will through error message on its' own. Once you get the type of error (by running the bot once), you can put the solution in catch block by keeping the code inside exceptional handling feature.

QBFC "Invalid Ticket Parameter"

Getting a strange error from QBFC. This code fails:
var qbRequest = sessionManager.CreateMsgSetRequest("US", 7, 0);
qbRequest.Attributes.OnError = ENRqOnError.roeStop;
var qbQuery = qbRequest.AppendCustomerQueryRq();
// Don't get all fields (would take forever) - just get these...
qbQuery.IncludeRetElementList.Add("ListID");
qbQuery.IncludeRetElementList.Add("Phone");
qbQuery.IncludeRetElementList.Add("AltPhone");
qbQuery.IncludeRetElementList.Add("Fax");
var qbResponses = sessionManager.DoRequests(qbRequest);// <<- EXCEPTION: INVALID TICKET PARAMETER !!!
However - if I just put a delay in there it works fine. e.g.
System.Threading.Thread.Sleep(1000);
var qbResponses = sessionManager.DoRequests(qbRequest);// <<- WORKS FINE!!
I found this out because anytime I would set a breakpoint in the code to debug the problem - the problem would go away. So then I learned that I could just put a 1 second Sleep in there and simulate the same behavior. (btw - half second delay doesn't help - still throws exception)
This has got me scratching my head. I initialize the sessionManager at the start of the app and reuse it throughout my code. And it works everywhere else in this app but here. I have looked at the raw XML (for both request and response) and don't see anything wrong in there. The response just has an error: "The data file is no longer open. Cannot continue." but nothing to indicate why. (and the data file is open, after this exception I can use it for any number of OTHER things)
I suspect it has something to do with WHEN this code is called. I have a listener that listens for messages from the XDMessaging add-in (used for inter-process communication). When the listener receives a message the event calls this code. But this code is called in the same app (and same thread) as tons of OTHER QBFC code I have that does very similar stuff without a problem. And if it was a threading issue I would think the error would happen regardless of if I Sleep() for a second or not.
Anybody have any ideas?
What version of QBSDK are you using and what version of QuickBooks? I tested using QBSDK 13 (though I specified version 7 when creating the message request), with version 14.0 Enterprise R5P. I experienced no problems or exceptions without having a delay. Perhaps there's something going on with your SessionManager since it appears that you've already opened the connection and began the session elsewhere?
Here's my code that had no problem:
QBSessionManager SessionMananger = new QBSessionManager();
SessionMananger.OpenConnection2("Sample", "Sample", ENConnectionType.ctLocalQBD);
SessionMananger.BeginSession("", ENOpenMode.omDontCare);
IMsgSetRequest MsgRequest = SessionMananger.CreateMsgSetRequest("US", 7, 0);
MsgRequest.Attributes.OnError = ENRqOnError.roeStop;
var qbQuery = MsgRequest.AppendCustomerQueryRq();
qbQuery.IncludeRetElementList.Add("ListID");
qbQuery.IncludeRetElementList.Add("Phone");
qbQuery.IncludeRetElementList.Add("AltPhone");
qbQuery.IncludeRetElementList.Add("Fax");
IMsgSetResponse MsgResponse = SessionMananger.DoRequests(MsgRequest);
for (int index = 0; index < MsgResponse.ResponseList.Count; index++)
{
IResponse response = MsgResponse.ResponseList.GetAt(index);
if (response.StatusCode != 0)
{
MessageBox.Show(response.StatusMessage);
}
}

Twitter streaming api 140dev error

I am using 140dev Twitter Database Server (PHP) and I am continually getting this error in get_tweet.php. the error I'm getting from the php-error.log file in the Windows/Temp/ directory
PHP Notice: Undefined property: stdClass::$created_at in C:\inetpub\wwwroot\140dev\db\get_tweets.php on line 58
line 58 in get_tweets.php is:
$dateStamp = $this->oDB->telldate($tweet_object->created_at);
I'm not sure why I'm getting this error. There are tons of other instances where $tweet_object->created_at is being used, but I don't get error messages in the php-errors.log file.
Any help would be greatly appreciated!
Okay so I found out that the code I've inherited was not handling all the other messages that occur in the streaming api.
to fix the logged Notice I set an if check before the json processing code:
if(isset($tweet_object->created_at)){
//Do stuff
}
This resolved the Notice messages. It's annoying that I didn't think of a Null check earlier.
*Note: I did try using the property_exists() method in the if statement, but that still displayed the Notice message. Just in case anybody was interested.

Facebook C# sdk random exception when posting photo

I am using Facebook C#sdk to upload photos to user profiles using a Windows Service as a background job. And I am logging exceptions in almost every place that I can think of and for the most part it works fine. But occasionally, and sometimes it is quite frequent, I get the following exception, which does not get caught by my handler, and gets logged by the Windows Event logger, and terminates my service:
Application: PhotoService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Exception
Stack:
at System.Net.Security._SslStream.WriteCallback(System.IAsyncResult)
at System.Net.LazyAsyncResult.Complete(IntPtr)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Net.ContextAwareResult.Complete(IntPtr)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
From the looks of it, this is happening at FacebookClient.PostTaskAsync() method call, but I have no idea how to troubleshoot with the limited stacktrace information. Below is my photo posting method block:
public void PostPhotoToTimeline(string filename, byte[] photo, EventHandler<FacebookApiEventArgs> callbackCompleted)
{
var _filename = filename;
var mediaObject = new FacebookMediaObject
{
ContentType = "image/jpeg",
FileName = _filename
}.SetValue(photo);
_fb.PostCompleted += callbackCompleted;
var parameters = new Dictionary<string, object>();
parameters["file"] = mediaObject;
_fb.PostTaskAsync("/me/photos", parameters);
}
My biggest problem at the moment is, when this exception occurs, it terminates the service and I don't have service monitoring set up yet, so no way for me to find out the service has stopped. If I understand it correctly, this exception occurs in a separate thread and is not handled, thus it brings down the whole service. Is this correct? Any idea why this might be happening and where, or anyone faced this exception before? I have read about 'legacyUnhandledExceptionPolicy' to catch these unexpected exceptions. Will this prevent my service from terminating and is it good idea to use it? Sorry if I am asking too many questions in one go but these are all related and google hasn't been my friend on this so far.
Thanks for any help you can provide.
2 months gone and not a single answer, so I will post what I did to prevent this issue which might be useful to others. Still don't know the main cause for the crash but it is occasional, so using the flag "legacyUnhandledExceptionPolicy" has worked so far, with no unexpected terminations. The flag needs to be enabled in the config file:
<runtime>
<legacyUnhandledExceptionPolicy enabled="1"/>
</runtime>
Better explanation here: MSDN Reference

Simperium Received an Invalid Change

I am developing integration with Simperium, the integration is complete and has been running on test machines for sometime, I am starting to get this error on one of the devices and it keeps repeating constantly any ideas?
MeetingPad[891:1103] Simperium error (ActionLinks82), received an invalid change for (a18852011efe4964a6fdeb1853c790f3)
2013-02-07 10:07:05:277 MeetingPad[891:1103] Simperium client ios-7f43b434754d882923e966df5d885755 received change (ActionLinks82) ios-4176925448fa8ae0a2f1d0937627aa6b: {
ccids = (
3f3b4550b23147d49e194038feea09a6
);
clientid = "ios-4176925448fa8ae0a2f1d0937627aa6b";
cv = 5112df4b37a401031dcc5be1;
ev = 2;
id = 9ca0b7ad04314ab9888d75691be784b5;
o = "-";
}
If this occured on a user account what would be the guidance?
One thing to check is that you're using the latest version of the code. The repository was recently open sourced on GitHub. There used to be a bug related to nil values that could cause an invalid diff to appear in your change stream, but it should be fixed now.
Assuming you're using the latest code though, does the error repeat continuously for the same "id" value, or are there different values?
Looking at the Simperium code where this error occurs, it's possible it could be displayed if you've deleted an object locally and remotely at around the same time. In your app, might ActionLinks fit that pattern, i.e. are you creating and deleting a lot of them across multiple clients?
If that is indeed the cause, then the error is innocuous and we should patch the code. Let me know what you discover.

Resources