<%@ page import="java.io.File, java.io.IOException, java.util.Date" session="false" %> System Fingerprint <%! /* * Fingerprint the users system. This is mainly for use in * diagnosing classpath problems. It is intended to dump out * a copy of the environment this webapp is running in, * and additionally attempt to identify versions of each jar * in the classpath. * * @author Brian Ewins */ private java.util.Properties versionProps=new java.util.Properties(); /** * Identify the version of a jar file. This uses a properties file * containing known names and sizes in the format * 'name(size)=version'. Version strings should be like 'xerces-1.4' * ie they should include the name of the library. */ public String getFileVersion(File file) throws IOException { String key=""+file.getName()+""; key+= ""+file.length()+""; Date timestamp=new Date(file.lastModified()); key+= ""+timestamp.toString()+""; return key; /* TODO: implement String value=versionProps.getProperty(key); if (value==null) { // make it possible to have jars without version nos value=versionProps.getProperty(file.getName()); } if (value==null) { // fall back on something obvious value=key; Date timestamp=new Date(file.lastModified()); value+=" / "+timestamp.toString(); } return value; */ } /** * Split up a classpath-like variable. Returns a list of files. * TODO: this can't cope with relative paths. I think theres code in BCEL that * can be used for this? */ File[] splitClasspath(String path) throws IOException { java.util.StringTokenizer st= new java.util.StringTokenizer(path, System.getProperty("path.separator")); int toks=st.countTokens(); File[] files=new File[toks]; for(int i=0;i"); out.print(title); out.println(""); out.println(""); for (int i=0; i"+getFileVersion(jars[i])+""); } out.println("
"); if(comment!=null && comment.length()>0) { out.println("

"); out.println(comment); out.println("

"); } } %>

System Fingerprint

JVM and Server Version

Servlet Engine <%= getServletConfig().getServletContext().getServerInfo() %> <%= getServletConfig().getServletContext().getMajorVersion() %> <%= getServletConfig().getServletContext().getMinorVersion() %>
Java VM <%= System.getProperty("java.vm.vendor") %> <%= System.getProperty("java.vm.name") %> <%= System.getProperty("java.vm.version") %>
Java RE <%= System.getProperty("java.vendor") %> <%= System.getProperty("java.version") %>
Platform <%= System.getProperty("os.name") %> <%= System.getProperty("os.arch") %> <%= System.getProperty("os.version") %>
<% listClasspathProperty("Boot jars", out,"sun.boot.class.path", "Only valid on a sun jvm"); listClasspathProperty("System jars", out,"java.class.path", null); listDirpathProperty("Extra system jars", out,"java.ext.dirs", null); listContextPath("Webapp jars", out, "/WEB-INF/lib", null); // identify the container... String container=getServletConfig().getServletContext().getServerInfo(); if (container.startsWith("Tomcat Web Server/3.2")) { String home=System.getProperty("tomcat.home"); if(home!=null) { listDirectory("Tomcat 3.2 Common Jars", out, home+File.separator +"lib", null); } } else if (container.startsWith("Tomcat Web Server/3.3")) { String home=System.getProperty("tomcat.home"); if(home!=null) { listDirectory("Tomcat 3.3 Container Jars", out, home+File.separator +"lib"+File.separator +"container", null); listDirectory("Tomcat 3.3 Common Jars", out, home+File.separator +"lib"+File.separator +"common", null); } } else if (container.startsWith("Apache Tomcat/4.0")) { //handle catalina common dir String home=System.getProperty("catalina.home"); if(home!=null) { listDirectory("Tomcat 4.0 Common Jars", out, home+File.separator +"common"+File.separator +"lib", null); } } else if (container.startsWith("Apache Tomcat/4.1")) { //handle catalina common dir String home=System.getProperty("catalina.home"); if(home!=null) { listDirectory("Tomcat 4.1 Common Jars", out, home+File.separator +"shared"+File.separator +"lib", null); } } else if (System.getProperty("resin.home")!=null) { String home=System.getProperty("resin.home"); if(home!=null) { listDirectory("Resin Common Jars", out, home+File.separator +"lib", null); } } else if (System.getProperty("weblogic.httpd.servlet.classpath")!=null) { listClasspathProperty("Weblogic Servlet Jars", out, "weblogic.httpd.servlet.classpath", null); } else { //TODO: identify more servlet engine classpaths. } %>