ASF Bugzilla – Attachment 30754 Details for
Bug 55470
Help users for ClassNotFoundExceptions during startup [PATCH]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
a patch that would help anybody with classpath problem save a lot of time
ObjectCreateRulePatch.txt (text/plain), 2.05 KB, created by
Ralf Hauser
on 2013-08-23 11:56:24 UTC
(
hide
)
Description:
a patch that would help anybody with classpath problem save a lot of time
Filename:
MIME Type:
Creator:
Ralf Hauser
Created:
2013-08-23 11:56:24 UTC
Size:
2.05 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P tomcat7trunk >Index: java/org/apache/tomcat/util/digester/ObjectCreateRule.java >=================================================================== >--- java/org/apache/tomcat/util/digester/ObjectCreateRule.java (revision 1516628) >+++ java/org/apache/tomcat/util/digester/ObjectCreateRule.java (working copy) >@@ -19,6 +19,10 @@ > package org.apache.tomcat.util.digester; > > >+import java.io.PrintStream; >+import java.net.URL; >+import java.net.URLClassLoader; >+ > import org.xml.sax.Attributes; > > >@@ -141,12 +145,47 @@ > } > > // Instantiate the new object and push it on the context stack >- Class<?> clazz = digester.getClassLoader().loadClass(realClassName); >- Object instance = clazz.newInstance(); >- digester.push(instance); >+ ClassLoader classLoader = digester.getClassLoader(); >+ try { >+ Class<?> clazz = classLoader.loadClass(realClassName); >+ Object instance = clazz.newInstance(); >+ digester.push(instance); >+ } catch (ClassNotFoundException t) { >+ PrintStream printStream = System.err; >+ printStream.println(t.getMessage()); >+ t.printStackTrace(printStream); >+ showClassPath(classLoader, printStream); >+ throw t; >+ } > } > > >+ public void showClassPath(ClassLoader classLoader, PrintStream printStream) { >+ StringBuffer extraInfo = new StringBuffer("ClassLoader "+classLoader+"\n"); >+ if (classLoader instanceof URLClassLoader) { >+ URLClassLoader ucl = (URLClassLoader) classLoader; >+ URL[] urls = ucl.getURLs(); >+ if (null == urls || 0 == urls.length) { >+ extraInfo.append("null == urls"); >+ } else { >+ int i = 0; >+ for (i = 0; i < urls.length; i++) { >+ URL url = urls[i]; >+ extraInfo.append(url.toString()).append(",\n"); >+ } >+ printStream.println(extraInfo); >+ } >+ ClassLoader parent = ucl.getParent(); >+ if (null != parent) { >+ if (!parent.equals(ucl)) { >+ printStream.println("\nParent:"); >+ showClassPath(parent, printStream); >+ } >+ } >+ } >+ } >+ >+ > /** > * Process the end of this element. > *
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 55470
:
30754
|
30755