ClassLoader

From Resin 3.0

Revision as of 05:26, 17 November 2005 by Ferg (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


See Also

class-loader describes ClassLoader configuration

Show the classpath/classloaders for the web-app

The following jsp will reveal the classpath that is in effect for your web-app (but not if you are using the servlet-hack):

<%@ page import="com.caucho.loader.*, java.util.*" %>

    <% LinkedList loaders = new LinkedList(); ClassLoader loader = Thread.currentThread().getContextClassLoader(); while (loader != null) { loaders.addFirst(loader); loader = loader.getParent(); } Iterator iter = loaders.iterator(); while (iter.hasNext()) { loader = (ClassLoader) iter.next(); out.print("
  1. "); out.println(loader.toString()); if (loader instanceof DynamicClassLoader) { out.print("
      "); DynamicClassLoader dynamicClassLoader = (DynamicClassLoader) loader; String classPath = dynamicClassLoader.getLocalClassPath(); String pathSeparator = "" + java.io.File.pathSeparatorChar; classPath = "
    • " + classPath.replace(pathSeparator, "\n
    • "); out.println(classPath); out.print("
    ");
        }
      }
    %>
    
Personal tools