How to trace a java-program
As a sysadmin I sometimes face situations, where a program behaves abnormally, while not creating errors at all or creating nonsense error-messages. In the past - before java came in - there were two counter-measures:
I usually use Are there better ways to do that (if the source-code is not available)? |
|||
As ckhan mentioned, Another useful tool is
This heap dump can be loaded in tools like Another tool, Finally, it is possible to use a Java Agent to push instrumentation on all methods of all objects at load-time. The library My Suggestion - start with VisualVM and see if that tells you what you need to know since it can show the current threads and important stats for the JVM. |
|||||
|
In the same vain when debugging programs that have gone awry on a Linux system you can use similar tools to debug running JVMs on your system. Tool #1 - jvmtopSimilar to
Its output is similarly styled to look like the tool
Tool #2 - jvmmonitorAnother alternative is to use jvmmonitor. JVM Monitor is a Java profiler integrated with Eclipse to monitor CPU, threads and memory usage of Java applications. You can either use it to automatically find running JVMs on the localhost or it can connect to remote JVMs using a port@host. Tool #3 - visualvmvisualvm is probably "the tool" to reach for when debugging issues with the JVM. Its feature set is pretty deep and you can get a very in depth look at the innards. Profile application performance or analyze memory allocation: Take and display thread dumps: References |
|||
Consider See also the suggestions at this SO article: http://stackoverflow.com/questions/1025681/call-trace-in-java |
||||
If you are using RHEL OpenJDK (or similiar, the point is that it is not Oracle's JDK), you may use SystemTap for that. Some probes are enabled by using java command line options Here is example SystemTap Script:
You can also use Note that SystemTap will trace every method. It is also not able to get method's arguments. Another option is to use JVM own capabilities of tracing which is called JVMTI. One of the most famous JVMTI implementations is BTrace. |
How to trace a java-program的更多相关文章
- Core Java Volume I — 3.1. A Simple Java Program
Let’s look more closely at one of the simplest Java programs you can have—one that simply prints a m ...
- Java program to find the largest element in array
Java program to find the largest element in array Given an array of numbers, write a java program to ...
- jstack(Stack Trace for Java)
功能 用于生成虚拟机当前时刻的线程快照(一般称为threaddump或javacore文件).线程快照就是当前虚拟机内每一条线程正在执行的方法堆栈的集合,生成线程快照的主要目的是定位线程出现长时间 ...
- 2013.11.7-21:15_My first Java program
- Caused by: java.lang.NoSuchFieldError: TRACE
Caused by: java.lang.NoSuchFieldError: TRACE at org.slf4j.impl.Log4jLoggerAdapter.trace(Log4jLoggerA ...
- How to Create a Java Concurrent Program
In this Document Goal Solution Overview Steps in writing Java Concurrent Program Template ...
- Spark-HBase集成错误之 java.lang.NoClassDefFoundError: org/htrace/Trace
在进行Spark与HBase 集成的过程中遇到以下问题: java.lang.IllegalArgumentException: Error while instantiating 'org.apac ...
- 编写一个应用程序,利用数组或者集合, 求出"HELLO",“JAVA”,“PROGRAM”,“EXCEPTION”四个字符串的平均长度以及字符出现重复次数最多的字符串。
public class Number { public static void main(String[] args) { String[] arr = { "HELLO", & ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- [Java Basics] Stack, Heap, Constructor, I/O, Immutable, ClassLoader
Good about Java: friendly syntax, memory management[GC can collect unreferenced memory resources], o ...
随机推荐
- centos6.5搭建vpn服务器
1 安装ppp yum install -y ppp 2 安装pptpd yum install pptpd // rpm -Uvh http://poptop.sourceforge.net ...
- python之--输入输出
python之输出 用print加上字符串,就可以向屏幕上输出指定的文字.用代码实现如下: >>> print "i love baby!" i love bab ...
- 二维卷积c代码
二维卷积c代码 二维信号的卷积原理请参考另外一篇文章:http://blog.csdn.net/carson2005/article/details/43702241 这里直接给出参考代码: void ...
- 你晓得吗?大多数企业根本没有做到 DevOps!
作为当代 IT 企业提升效率的葵花宝典,DevOps 对 IT 企业效率的提升有目共睹 ,一时之间各大企业纷纷用提升效率的 DevOps 开发.协作.管理工具武装自己. 对比 2014 年上半年,CS ...
- 【HDU 4276】The Ghost Blows Light(树形DP,依赖背包)
The Ghost Blows Light Problem Description My name is Hu Bayi, robing an ancient tomb in Tibet. The t ...
- 记录一下MYSQL的SQL语法
这是加时间的语法 update mylog set mydate= DATE_ADD( mydate, INTERVAL 13 HOUR) WHERE mydate BETWEEN '2014-0 ...
- 如何在C++中使用WebService
gsoap主页 http://sourceforge.net/projects/gsoap2 使用gsoap生成所需的WebService 下载后的gsoap包为:(点击到我的资源中下载) 将他解 ...
- Android开源项目发现---Layout 篇(持续更新)
1. achartengine 强大的图标绘制工具 支持折线图.面积图.散点图.时间图.柱状图.条图.饼图.气泡图.圆环图.范围(高至低)条形图.拨号图/表.立方线图及各种图的结合 项目地址:http ...
- Adroid解析json
参考资料: http://www.open-open.com/lib/view/open1326376799874.html http://www.cnblogs.com/tt_mc/archive/ ...
- wcf异常汇总
1.确保客户端可以接收到服务端的异常 2.部署wcf出错,http错误404.3 3.无法自动调试 未能调试远程过程.这通常说明未在服务器上启用调试 WCF 托管在IIS上 4.ChannelFact ...