开发者

Tracing the execution of a java program running on a remote *nix machine

开发者 https://www.devze.com 2023-02-16 18:45 出处:网络
I am trying to debug a program running on a remote solaris machine. I wanted to know path taken by the program during the execution just like stake tr开发者_如何学Goace

I am trying to debug a program running on a remote solaris machine. I wanted to know path taken by the program during the execution just like stake tr开发者_如何学Goace like

Class A.method1 called method2 in class B
Class B.method2 called method3 in class C
..
...
Control returned from method2 in class B to
method1 in Class A etc

We cannot run the program from eclipse since the environment cannot be reproduced since it is a large enterprise level system having many upstream and downstream systems.

I suspect somewhere in the program there is an exception being thrown and that is not handled properly like a empty catch block/not logging or rethrowing the exception.

What is the best way to debug such programs. Please help me with your solutions.


You can use Eclipse to debug remote applications, all you need to do is add a few startup parameters: http://eclipse.dzone.com/articles/how-debug-remote-java-applicat


You can debug remotely with eclipse, see this


If you want to trace the execution of your Java code you can use a tool called InTrace.

InTrace supports outputting the trace from a Java program to disk or over the network to the InTrace UI. This should be ideal for debugging your Java program on a remote solaris machine.

NOTE: InTrace is a free and open source tool which I have written.


Since, your remote machine runs under Solaris you could use DTrace to dynamically add probes to your running JVMs and the complete system.


You could remote debug, which Eclipse supports, but may not be permitted by the system admin. The only other thing I can think of is lots and lots of logging


in such cases I have used Btrace https://dzone.com/articles/introduction-btrace , it doesn't require you to setup a remote debugger, nor to have the source code of your Java application.

Another way is to run jdb https://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html and attach to the process - but you must enable the process JVM to use jdwp -agentlib:jdwp=transport=dt_shmem,server=y,suspend=n

In general I agree that the JDK is lacking a professional built-in tracing/debugging tool

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号