This discussion is archived
3 Replies Latest reply: Dec 5, 2012 11:37 AM by jschellSomeoneStoleMyAlias RSS

debug and trace for java class

725537 Newbie
Currently Being Moderated
Hi,
I write a java program XX.class.
I run it by /java -cp. XX
But I find this program disaapear suddenly in linux host .
There is no expection in the log file it produce .

How I can debug and find what probelm it is ???Any suggestion ..

I also use strace - p < java process> ....to check the process " ./java -cp. xx"
I only find there is something like " resourcec temporarily unavailable" but no idea any more .
The hd is not full . .....There is space toread /write in OS file system .

Any suggetion to debug this problem ????
  • 1. Re: debug and trace for java class
    gimbal2 Guru
    Currently Being Moderated
    Well what I would do is add trace logging. Let the application log out what it does at trace logging level, then check what was last in the logs. That should give a clue where the problem originates.

    And THEN... its a question of trying to reproduce the problem locally, which can be an incredibly annoying and time consuming process :/

    Do you have a clue how long it takes before the application 'suddenly disappears' ? It might be related to the heap space running out, meaning you have a memory or resource leak somewhere.
  • 2. Re: debug and trace for java class
    DarrylBurke Guru Moderator
    Currently Being Moderated
    Cross posted
    http://www.java-forums.org/advanced-java/65968-trace-debug-java-class.html

    db
  • 3. Re: debug and trace for java class
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    user6820833 wrote:
    Any suggetion to debug this problem ????
    Catch "Throwable" not Exception at the root of every thread. And log it.

    You can also look at java.lang.Thread.setUncaughtExceptionHandler();

    Also create a log statement for the exit of every thread. Because if every thread exits then so does the application.

    You would need to do the above in every thread.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points