I am pretty new in Java EE, i am trying use that .war
file http://community.jboss.org/wiki/ThreadDumpJSP , but it seems index.jsp
file doesn't show variable, I see only ${thr.name} ${thr.state} ${thr.priority} ${thr.daemon}
I am tested it on jboss
and tomcat 6
edit:
here is code:
package org.jboss.varia.threaddump.ThreadDumpBean;
import java.io.Serializable;import java.util.*;
public class ThreadDumpBean implements Serializable {
private final Map traces;
public ThreadDumpBean() {traces = new TreeMap(THREAD_COMP);traces.putAll(Thread.getAllStackTraces());}
public Collection getThreads() {return traces.keySet();}
public Map getTraces() {return traces;}
/*** Compare the threads by name and id.*/
private static final Comparator THREAD_COMP = new Comparator() {
public int compare(Thread o1, Thread o2) {
int result = o1.getName().compareTo(o2.getName());
if (result == 0) {
Long id1 = o1.getId();
Long id2 = o2.getId();
return id1.compareTo(id2);
}
return result;
}};
}
and .jsp
:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<jsp:useBean id="threadDump"
class="org.jboss.varia.threaddump.ThreadDumpBean"
scope="request"/>
<html>
<body>
<h2>Thread Summary</h2>
<table cellpadding="5" cellspacing="5">
<tr>
<th>Thread</th>
<th>State</th>
<th>Priority</th>
<th>Daemon</th>
</tr>
<c:forEach items="${threadDump.threads}" var="thr">
<tr>
<td><c:out value='<a href="#${thr.id}">${thr.name}</a>' escapeXml="false"/></td>
<td><c:out value="${thr.state}"/></td>
<td><c:out value="${thr.priority}"/></td>
<td><c:out value="${thr.daemon}"/></td>
</tr>
</c:forEach>
</table>
<h2>Thread Stack Traces</h2>
<c:forEach items="${threadDump.stackTraces}" var="trace">
<h4><c:out value='<a name="${trace.key.id}">${trace.key}</a>' escapeXml="false"/></h4>
<pre>
<c:forEach items="${trace.value}" var="traceline">
at <c:out value="${traceline}"/></c:forEach>
</pre>
</c:forEach>
</body>
</html>