I experience a strange problem. Sometimes our Java app will not start and will raise an IOException when trying to open a OtpNode. Here is the code (really nothing special):
OtpNode oNode = new OtpNode(NODE);
oNode.setCookie(COOKIE);
OtpMbox mbox = oNode.createMbox(MBOX);
NODE, COOKIE and MBOX are hardcoded constants. The error I get is:
class java.io.IOException,
'Nameserver not responding on Martin-PC when publishing jnode',
Stack trace: [Ljava.lang.StackTraceElement;#c3ea5a
That's it. And this happens only sometimes. I observed that when restarting the PC it happens.
Had anyone seen similar problem?
Thank you.
It turned out that after restrat the Erlang virtual machine sometimes is not running. So we need to start it first before Java OtpNode could be started:
erl -sname whatever
http://www.erlang.org/doc/man/erl.html
Related
I want to close my Android application with a method, but it should be shown a custom message (which I define for myself).
everything I found yet was "How to close my application" and I got more than 10 ways to close my application but I haven't found a way to set a custom message.
At the moment if my app crashes something like this appears:
[APPNAME] has been stopped
I want something like this
Congratulations! You found a bug, please submit it.
Is there even a way to do that? All methods I found just closed all activities or just forced an unresolveable error.
I don't think you need some code from me, but if you do, tell me.
(Language should be java and javascript/jQuery should be avoided)
You could try making a static stop method:
public static void stop(String message) {
Log.d(message);
System.exit(0);
}
In play framework, every time you get an Internal Server Error (500) in production mode, the browser shows a web page with
Oops, an error occured, This exception has been logged with id XXXX
I would like to customize the error message (or at least translate it to spanish), keeping the error id that makes it easier to look for in the application log.
I've tried to configure an error page in the Global settings in JAVA like this:
public Promise<Result> onError(RequestHeader request, Throwable t) {
return Promise.<Result>pure(internalServerError(
views.html.error.render(t)
));
}
Where I've a view named error.scala.html.
It is not working right now, it does not show any errors, just ignores it. Also with this alternative, I don't know how to display the error id.
I appreciate any suggestions, thanks a lot.
Is your Global class in the root package? That's a quite common mistake and also the reason why it is ignored.
Summary
This happened since May 20th's night (Pacific Time). Initially, I thought it was Google Cloud Storage failure. It seems now that they supported my way of storing data before. But somehow, after May 20th, that API does not work the same way as before.
How did I call
GcsFileOptions fileOptions = new GcsFileOptions.Builder().mimeType("image/png").acl("public-read").build();
GcsFilename filename = new GcsFilename(fileBucket, objectName); // fileBucket="test", objectName="/code/my/yeuei"
GcsService service = GcsServiceFactory.createGcsService();
GcsOutputChannel oc = service.createOrReplace(filename,fileOptions); //error happens here.
Error
Google Cloud Storage API gives error when the object is not existing.
GcsServiceImpl.createOrReplace method
I am creating a new object.
E 10:03:00.643 com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
com.google.appengine.tools.cloudstorage.NonRetriableException: java.lang.NullPointerException
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:120)
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:166)
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:156)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl.createOrReplace(GcsServiceImpl.java:68)
This line seems causing the error -
Caused by: java.lang.NullPointerException
at com.google.appengine.tools.cloudstorage.oauth.URLFetchUtils$HTTPRequestInfo.<init>(URLFetchUtils.java:80)
at com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsService.beginObjectCreation(OauthRawGcsService.java:184)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:71)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:68)
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:108)
Nothing on the status page. You might wish to check it in the future.
Ok. This is resolved. I am still not sure how it is introduced in the first place.
Here is what happens -
There is a class URLFetchUtils in App Engine GCS Client library, when it initiates, it did not check if payload is null, that creates the NullPointer exception. Today, GCS Java Client Library has an update fixed this issue, so if you use the latest version (app engine GCS 0.3.12), this error will go away. Interestingly, I have no idea how it worked before :) ... But anyway, I am glad that my app is working again - after about 24 hours down.
I am working in a client-server application(web start) which is started by url http:\[ip of server]:[port]. It loads index.html in the browser and main application pops up in another window and here we have several option to see/perform status/action.
Recently i got an issue of server status being displayed as unknown which is default, but it after loading application it should be loaded. I found the cause of it, that method to display server status being executed at start, so i use while loop to check if application loads, then i executed that method. It worked.
But if i exit the pop up(main application) and refresh the url in main browser window, application pops up successfully but without server status, There is nothing about server status. It leads me to think that while cut the pop up, serverStatus class did not unload.
I tried to learn about class loader but did not get anything and not able to find anything in application source code about loading/unloading of a class.
Could someone please guide or give reference to a study materiel that could solve my problem.
Please pardon me if i am not clear in asking the exact question and please ask if more information is required. Thanks in Advance
The changed code is here:
#Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
PrintWriter out = new PrintWriter(
new OutputStreamWriter(response.getOutputStream(), "UTF-8"));
synchronized(this){
while(!notCompleted){
Thraed.sleep(100)}
out.println("<LABEL><B>" + discoveryStatusLabel_ +
" :</B></LABEL> <SPAN ID='DiscoveryStatus'>" +
discoveryStatus_ + "</SPAN>");}
}
where i added the while loop, and notCompleted is variable to check if application loaded fully.
Note: There are more code in doGet() and synchronized block apart from this.
I am using Twitter4J 2.2.5 (latest, tried other versions). And can no longer get direct messages to work at all. The same code used to work a while ago. I assume Twitter changed something.
I'm using
Twitter.getDirectMessages()
and it gives the error below. No idea why, I can see the direct messages for the account if I login, but always get this error. The limit error makes no sense, as the account is no where near the limit.
Other API work, like followers/fried/status/etc.
403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (http://support.twitter.com/forums/10711/entries/15364).
Relevant discussions can be on the Internet at:
http://www.google.co.jp/search?q=00919618 or
http://www.google.co.jp/search?q=332bf6ca
TwitterException{exceptionCode=[00919618-332bf6ca], statusCode=403, retryAfter=0, rateLimitStatus=RateLimitStatusJSONImpl{remainingHits=107, hourlyLimit=350, resetTimeInSeconds=1328297, secondsUntilReset=1116, resetTime=Fri Feb 03 14:39:45 EST 2012}, version=2.2.2}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:189)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:93)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1721)
at twitter4j.TwitterImpl.getDirectMessages(TwitterImpl.java:874)
at org.pandora.sense.twitter.TwitterDirectMessaging.checkDirectMessages(TwitterDirectMessaging.java:44)
at org.pandora.sense.twitter.TwitterDirectMessaging.checkProfile(TwitterDirectMessaging.java:35)
at org.pandora.sense.twitter.Twitter$1.run(Twitter.java:100)
at java.lang.Thread.run(Thread.java:662)
Twitter has some time ago changed the rules for direct messages. An app must be especially authorized by the user to access the direct messages.
Did you make sure this is true for you? You may go to the twitter web site and check for the app.
To get the direct message you should try the below code.It works for me.
getDirectMessages(); gives list of direct messages. We need to put for loop to get text of each message.
List<DirectMessage> messages = twitter.getDirectMessages();
for (DirectMessage message : messages)
{
System.out.println(message.getText());
}
Let me know if you get any error.