views:

390

answers:

3

I wanted to get ideas from the SO community about this issue.

Here is the problem:

We have a user on the other side of the world launching our app through WebStart. The user, however, is complaining that her whole application freezes up and becomes unresponsive. Usually, the client is doing a lot of database queries to a distributed database.

Questions:

  1. If we ask her to do a CTRL-Break on her application, where would the JVM write the stack trace to?
  2. Would it be enough just to use JConsole?
  3. Would implementing JMX beans on the client be overkill? Would it actually help in troubleshooting issues in production?

Right now the users are running on JRE 1.5.0-b08, but we do plan on migrating to JRE 6 in a couple of months.

What do you think?

A: 

You need to have the Java Console displayed (run javaws from the command line, and select this from the Preferences dialog), then hit "v"

kdgregory
Is there a way to grab the stack trace without the user noticing, or having some involvement in this?
Jose Chavez
+2  A: 

José, you can get a lot of information from the JVM in a number of ways.

The best might be to enable debugging in the remote JVM. You can set them using the j2se element in the descriptor XML, as shown here. Since you can set -Xdebug you have a good start; I've never tried to do remote debugging on a web start app, so it may be a little bit of an issue setting up the remote part.

You could also set some things up yourself by adding a separate thread to talk to you remotely and send debugging messages.

You could use a native java or log4j remote logger.

If it's hanging the way you describe, though, the odds are very high that what's happening is a network hangup of some sort. Can you put some tracing/debugging onto your end of the conversation?

Charlie Martin
By my end of the conversation, do you mean monitoring the traffic from the server side?
Jose Chavez
+1 for very useful links!
javashlook
I am going to try implementing jmxremote enabled on the webstart app. We can easily reach the user this way; all they have to do is give us their computer name, and we can remote using JConsole.
Jose Chavez
@José, I do mean monitoring from the server side. Let us know how the JMX reote works out; my experience with jmx hasn't been favorable but I haven't tried it in a while.
Charlie Martin
+1  A: 

Instead of these debugging suggestions, why don't you install an exception handler for your threads? See java.lang.Thread.

void setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler eh)

Here's the relevant javadoc: http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)

If you install that in your code, and once inside Swing's EDT, then just write some java code to e-mail it to yourself, save it on a server, show it to the user, etc.

Martin