My Java application hang - how to investigate reasons of that?

Posted on 2010-11-14
Last Modified: 2012-05-10

I have written some Java application (on PC), packaged it to JAR and started. But after some time it hang. According to a log files I can see that sometimes it happens after ArrayOutOfBounds exception.

My question is - what the usual/recommended ways to investigate and solve such issues?
I mean - what the usual/recommended Java debugging practices?

Is it possible to attach Java process with debugger and check stack, treads, variables and so on?

Run a debug session from Eclipse is not working in my case because my Java application has a specific model which (seems) could not be debugged from Eclipse.
So, yes, I'm writing code in Eclipse but cannot use it as debugger because some things do not work under the Eclipse debugger.
That is why I need something alike to attaching a running Java process with Java debugger and investigate it.
Is it possible at all? What tools/approaches could you could recommend?

Question by:Dmitry_Bond
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2

Expert Comment

ID: 34130871
I have  few suggestions and some questions.  When you say that you cannot use the Eclipse debugger do you mean than you cannot even run it from Eclipse.  To do this you can just right click on the code that contains your main function and click run as.  Then it will run directly from Eclipse you can view the output in the output window.  It will pop up if there is an exception.  The exception will then tell you which line of code it comes form and may even be a clickable link to take you straight there.
If you cannot run it in Eclipse exactly how are you running this.  Are you running this from a command line?  If not open up a command prompt, go to Start and then Run and type cmd.exe.  This will give you the commandline.  using cd navigate to the directory where your executable jar is and type java -jar <name executable jar>.  When you get your exception is should give you a stack trace that tells you where the error is occuring.
Otherwise you might want to look in to a profiler: or
LVL 86

Expert Comment

ID: 34130877
>>According to a log files I can see that sometimes it happens after ArrayOutOfBounds exception.

That's strange. Normally that would terminate things, not hang them

>>That is why I need something alike to attaching a running Java process with Java debugger

If you can't debug it in Eclipse, you can't debug it in anything. It's possible that some of the binaries have no debug info, in which case they'll need to be recompiled.

Can you post a zip of the source?
LVL 86

Expert Comment

ID: 34130880
Also, please attach the log file if you can
Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

LVL 92

Expert Comment

ID: 34132595
take a thread dump to determine why it has hung

Author Comment

ID: 34134362
> take a thread dump to determine why it has hung

Please provide some details how to do it?
Reference to tools and so on.
LVL 92

Accepted Solution

objects earned 250 total points
ID: 34134424

Assisted Solution

indigo23 earned 250 total points
ID: 34147163
try to use the jvisualvm, it is on %JAVA_HOME%/bin folder

Author Closing Comment

ID: 34430734
I cannot estimate answers because I was moved to another urgent project (non-java). So, the only thing I can do - close the question. Sorry.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
web application structure 18 112
Java Restore security prompts not working 10 125
Chrome and Firefox Java 5 67
Is there a simpler dropbox system? 10 44
Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question