Solved

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

Posted on 2010-11-14
8
781 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
Comment Utility
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
Comment Utility
>>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
Comment Utility
Also, please attach the log file if you can
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
take a thread dump to determine why it has hung
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Dmitry_Bond
Comment Utility
> 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
Comment Utility
0
 
LVL 3

Assisted Solution

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

Author Closing Comment

by:Dmitry_Bond
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresSpecial  challenge 13 40
endX challenge 2 48
parentbit challenge 3 51
Python Assistance 7 31
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now