Crash reporting for java - java

Do you know any good crash reporting systems for Java or any open source projects which use a crash reporting system?

Starting from simple
In case you want to report errors and exceptions to user in Java Swing Application htere is a nice library zeus-jscl that has several useful components:
gr.zeus.ui.JMessage - Displays simple messages and the stacktrace of an exception and more
gr.zeus.ui.JConsolePane - A java console to replace the command line window. Redirects the stdout and stderr etc.
This is sent nowhere it just locally convenient.
All of this brings me to how handles unhanded exceptions that occur in the wild. NetBeans pops up this little dialog and asks you to send in your report. Once you do send it, it's almost magical, reports are queued, analyzed, associated to either a new report or an existing report and finally the generic reports are associated to an issue in IssueZilla and it does it all automatically. If the issue is fixed, it even tells you in which, upcoming or not, version it has been fixed.
from here
You can download sources of NetBeans and rip off what you need. Read here how

The crash dump is just a text file. You could write a script which repeatedly runs your problem and mail you/notifies you of any new crash dumps.

Related

Collect exception reports in Java application

I'm currently maintaining a Desktop Java application that has a small to medium user base. I often get some pretty useless mails saying that "something went wrong" and I'm left digging through the source code, often unable to reproduce the problem.
Now I'm wondering if there is a library that would allow me to collect Exceptions when they happen, present a small dialog to the users and if/when they agree, post the stack trace to my webserver. Basically what I'm looking for is something similar to Application Crash Report for Android (ACRA), but for desktop Java applications.
If you are using SLF4J and Logback, you can configure an appender to send detailed error reports to a Ctrlflow Automated Error Reporting server (which offers filtering and aggregation of incoming reports + dashboards + email digest). This blog post has all the information on how to configure Logback accordingly.
If you want to present your user with a confirmation dialog first, you may have to extend the existing appender, though – unless your “Desktop Java application” is an “Eclipse Rich Client Platform applications.” In that case the work has already been done for you. See this webinar for more information.

iSeries JAVA program with RPGLE Interface crashes when processing images

I have made a java program that creates PDF files based to GnuPdf. It runs perfectly when run using native java code (on windows or iSeries QSH), however, when run through an RPGLE interface, the program crashes (at what seems like random intervals) when processing images. I tracked down one of these down to loading an image from a .jar file and removed the call from the code. It worked for a while but is now crashing for images loaded from IFS. Maybe RPGLE is locking the files somehow, and ideas? The code is called from a Service Program.
Here is the stacktrace
java.lang.NullPointerException
at gnu.jpdf.PDFImage.write(PDFImage.java:286)
at gnu.jpdf.PDFOutput.write(PDFOutput.java:114)
at gnu.jpdf.PDFDocument.write(PDFDocument.java:307)
at gnu.jpdf.PDFJob.end(PDFJob.java:182)
at com.mysite.pdf.PdfDocumentStateValid.endDocument(PdfDocumentStateValid.java:657)
at com.mysite.pdf.PdfDocument.endDocument(PdfDocument.java:36)
java.io.IOException: Descriptor not valid.
at java.lang.Throwable.<init>(Throwable.java:196)
at java.lang.Exception.<init>(Exception.java:41)
at java.io.IOException.<init>(IOException.java:40)
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:112)
at gnu.jpdf.PDFOutput.<init>(PDFOutput.java:96)
at gnu.jpdf.PDFDocument.write(PDFDocument.java:302)
at gnu.jpdf.PDFJob.end(PDFJob.java:182)
at java.awt.PrintJob.finalize(PrintJob.java:60)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:116)
at java.lang.ref.Finalizer.access$100(Finalizer.java:47)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:193)
Changing my answer here now that I can see the stack trace. The problem happens when you hit native code (native meaning you are basically drilling into OS level or OS custom code).
You are getting an IOException of Descriptor not valid (and by that I'm assuming it means the file descriptor (ie, FileDescriptor). Now the big difference between running it in QShell and running it from RPG is that the Java code invoked from RPG is probably invoked under a different ID and/or privilege level. You may have to make modifications to the iSeries to your program to grant it authority for Java to have the right authorities to do what it needs. (I know you would think that is something the SecurityManager in Java would have picked up...but I know wierd things can happens sometimes when you are using a custom JVM (read IBM's) on a custom OS (i5/OS). You are left to the mercy of the vendor (in this case IBM). Give that a shot (the permissions thing) and see if that solves your problem.
Also...I googled and just found this related to iSeries: https://www-304.ibm.com/support/docview.wss?uid=nas379538999e744aad1862575b0006e28ab
So it might be that the jt400 library used by the OS may have a flaw and you may need to PTF it and/or your JVM too. Just another thought of something to try.

Untraceable exception in java applet

I'm having some problems tracing the reason that I can't load a java(fx) applet.
The java plugin console for the browser has always been my sole source of information for problem solving. The reason it isn't much help at the moment is that the applet starts to load, downloading the jar files and outputting a percentage to the console along with the occasional statement to say it's on the next jar file. At some point in time (different percentages each time) the console just closes unexpectedly and the applet stops loading. I know this isn't much to go on but I was wondering if there was any way that the output from the console could be stored to a file on the local machine. To debug this particular problem, changing security permissions temporarily would be acceptable.
The problem has occured on every pc i've tried, however if I keep refreshing after failure it seems to cache the jar files previously downloaded and thus get further through the loading process until it eventually works. My issue now is that on a particular customers network refreshing does not resolve the issue. I thought it may be a permissions issue writing to disk but I've tried an administrator account and still no luck. I've also tried a variety of browsers. It might also be worth noting that they go through a proxy server - when the applet tries to load it asks for the credentials for logging on to the proxy which seems to authorise fine.
If anyone has a suggestion on what I could try it would be gratefully received.
Thanks,
James
Two points:
You should be able to get a stack trace through the applet console viewer (which runs in the system tray on PC's) and if you open that up it will show you your stack trace for debugging.
Can you reproduce this problem using the Java Applet Viewer tool? This will allow you to write unit tests, and debug much more easily.
I forget where it is, but somewhere in the java control panel (one of the options under the advanced tab I believe) there's an option to turn on logging. This will log all output to the java console to a file as well. I've used this when trying to debug issues similar to this.
There's some info here on where the files will appear:
http://download.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/tracing_logging.html
The problem ended up being some JS code that was making calls to the applet before the applet had initialised.

How to debug/log/trace an applet loading problem?

Recently two of our clients have reported problems with our applets. Looking at the java plugin console it is full of ClassNotFoundException so none of our code is executed.
I've been able to reproduce the stack trace using a virtual pc image with 0 free space on disk, but the problem goes away as I restore some disk space, and the users tell me that their disk is not full; they are able to create new files.
Our applet requires java 6, and the problem has appeared with updates 1, 10 and 14 of the jre. We have also tried different browsers (IE and Firefox), clearing the browser and java caches, ...
How can I debug or trace what is the jvm doing to load our applet?
I suppose that the problem lies on some security directive on windows so I'm using Sysinternal's Process Monitor to log the activity but I don't really know where to look at.
The Java cache is most likely messed up. Open Java in the Control Panel and get rid of all temporary files to see if it goes away.
Logging in the Java Console for loading applets can be enabled which helps quite alot (even if the plugin is extremely cryptic). See http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/tracing_logging.html
I've been looking at the plugin source from the JDK and I've found that there is additional debug info available in the logs setting the environment variable JPI_PLUGIN2_DEBUG.
Unfortunately I still only see ClassNotFound exceptions.
I've found a piece of the plugin code that swallows all exceptions, so maybe my users problem is there...
had similar problems a while ago. In our case, the problem seems to be how the applet tag is set up on the web page. If it is in a wrong order or contains the codebase attribute, it fails with 6u10+. This works for us:
<applet name="DMGANTT" archive="DMGantt.zip" code="dm.applet.DMGanttApplet"
width='100%' height='100%' mayscript="mayscript">
We had a similar problem with one of our clients. We discovered that it was a strange bug in some versions of Java related to proxy configuration on the client. See this article for the details
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6723715
Also, our applet failed with new versions for a different reason.
Now, in similar cases I ask them to check javatester.org, so that I can see if applets (in general) load OK in their browser. If that page loads OK, its a problem on our applet (or page). Else it's a problem in their configuration. I help them anyway but it's easier to debug.

How do I pipe the Java console output to a file?

I found a bug in an application that completely freezes the JVM. The produced stacktrace would provide valuable information for the developers and I would like to retrieve it from the Java console. When the JVM crashes, the console is frozen and I cannot copy the contained text anymore.
Is there way to pipe the Java console directly to a file or some other means of accessing the console output of a Java application?
Update: I forgot to mention, without changing the code. I am a manual tester.
Update 2: This is under Windows XP and it's actually a web start application. Piping the output of javaws jnlp-url does not work (empty file).
Actually one can activate tracing in the Java Control Panel. This will pipe anything that ends up in the Java console in a tracing file.
The log files will end up in:
<user.home>/.java/deployment/log on Unix/Linux
<User Application Data Folder>\Sun\Java\Deployment\log on Windows
/~/Library/Caches/Java/log on OS X
(If you can modify the code) you can set the System.out field to a different value:
System.setOut(new PrintStream(new FileOutputStream(fileName)));
If you are running a script (invoking the program via java) from Unix you could do:
/path/to/script.sh >& path/to/output.log
In Mac 10.8.2 logs could be found at /Users/<userName>/Library/Application Support/Oracle/Java/Deployment/log/.
Before you have to enable logging from Java Control Panel. Option "Enable logging" is at tab "Advanced". Java Control Panel could be started from "System preferences".
A frozen console probably means a deadlock (it could also mean repeated throwing of an exception). You can get a stack dump using jstack. jps may make finding the process easier.
try this guide it works for me. it also guides you that how you can set "System.setOut(fileStream);", "System.setErr(fileStream);"

Categories