Solved

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

Posted on 2010-11-14
8
785 Views
Last Modified: 2012-05-10
Hi.

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?

Regards,
Dmitry.
0
Comment
Question by:Dmitry_Bond
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 8

Expert Comment

by:robthewolf
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: http://www.yourkit.com/home/index.jsp or http://download.oracle.com/javase/6/docs/technotes/tools/share/jvisualvm.html
0
 
LVL 86

Expert Comment

by:CEHJ
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?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 34130880
Also, please attach the log file if you can
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 92

Expert Comment

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

Author Comment

by:Dmitry_Bond
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.
0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 34134424
0
 
LVL 3

Assisted Solution

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

Author Closing Comment

by:Dmitry_Bond
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.
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
difference of if loops 23 62
java jdbc batch example 8 41
hibernate insert example 13 34
Fast way to search item into Java Array (Rhino compatible) 2 31
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

840 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