3 Replies Latest reply: Dec 5, 2012 1:37 PM by jschellSomeoneStoleMyAlias RSS

    debug and trace for java class

      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
          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
            Cross posted

            • 3. Re: debug and trace for java class
              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.