ClassLoader
From Resin 3.0
(Difference between revisions)
Line 29: | Line 29: | ||
out.print("<li>"); | out.print("<li>"); | ||
− | out. | + | out.print(loader.toString()); |
+ | out.print(" System.identityHashCode()="); | ||
+ | out.println(System.identityHashCode(loader)); | ||
if (loader instanceof DynamicClassLoader) { | if (loader instanceof DynamicClassLoader) { | ||
Line 39: | Line 41: | ||
String pathSeparator = "" + java.io.File.pathSeparatorChar; | String pathSeparator = "" + java.io.File.pathSeparatorChar; | ||
− | classPath = "<li>" + classPath.replace(pathSeparator, "\n</li>"); | + | classPath = "<li>" + classPath.replace(pathSeparator, "\n</li><li>") + "</li>"; |
out.println(classPath); | out.println(classPath); | ||
Revision as of 18:23, 26 March 2008
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.*" %> <ol> <% 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("<li>"); out.print(loader.toString()); out.print(" System.identityHashCode()="); out.println(System.identityHashCode(loader)); if (loader instanceof DynamicClassLoader) { out.print("<ul>"); DynamicClassLoader dynamicClassLoader = (DynamicClassLoader) loader; String classPath = dynamicClassLoader.getLocalClassPath(); String pathSeparator = "" + java.io.File.pathSeparatorChar; classPath = "<li>" + classPath.replace(pathSeparator, "\n</li><li>") + "</li>"; out.println(classPath); out.print("</ul>"); } } %> </ol>