20060712 Wednesday July 12, 2006

Listing JVM Properties in Tomcat (or any servlet container)

While debugging a problem with the Alfresco document management server, I needed to find out if Tomcat was running with the server VM. I thought I had set it up correctly, but wanted to check to make sure. To do this, I created the following JSP (which I called props.jsp) and deployed it in an existing webapp.

Sure enough, when I ran it, I saw java.vm.name=Java HotSpot(TM) Client VM, which was not what I wanted to see. Turns out I was running the client VM after all.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<pre>
<%
Properties props = System.getProperties();
props.list(new PrintWriter(out));
%>
</pre>
</body>
</html>

Posted by rickg ( Jul 12 2006, 09:30:49 PM PDT ) Permalink Comments [0]