View | Details | Raw Unified | Return to bug 55470
Collapse All | Expand All

(-)java/org/apache/tomcat/util/digester/ObjectCreateRule.java (-3 / +46 lines)
Lines 19-24 Link Here
19
package org.apache.tomcat.util.digester;
19
package org.apache.tomcat.util.digester;
20
20
21
21
22
import java.net.URL;
23
import java.net.URLClassLoader;
24
25
import org.apache.juli.logging.Log;
22
import org.xml.sax.Attributes;
26
import org.xml.sax.Attributes;
23
27
24
28
Lines 141-151 Link Here
141
        }
145
        }
142
146
143
        // Instantiate the new object and push it on the context stack
147
        // Instantiate the new object and push it on the context stack
144
        Class<?> clazz = digester.getClassLoader().loadClass(realClassName);
148
        ClassLoader classLoader = digester.getClassLoader();
145
        Object instance = clazz.newInstance();
149
        try {
146
        digester.push(instance);
150
            Class<?> clazz = classLoader.loadClass(realClassName);
151
            Object instance = clazz.newInstance();
152
            digester.push(instance);
153
        } catch (ClassNotFoundException t) {
154
            Log log = digester.log;
155
            log.warn(t.getMessage(), t);
156
            showClassPath(classLoader, 0, log);
157
            throw t;
158
        }
147
    }
159
    }
148
160
161
    public static void showClassPath(ClassLoader classLoader,
162
            int antiRecursion, Log log) {
163
        StringBuffer extraInfo = new StringBuffer("ClassLoader " + classLoader
164
                + "\n");
165
        if (classLoader instanceof URLClassLoader) {
166
            URLClassLoader ucl = (URLClassLoader) classLoader;
167
            URL[] urls = ucl.getURLs();
168
            if (null == urls || 0 == urls.length) {
169
                extraInfo.append("null == urls");
170
            } else {
171
                int i = 0;
172
                for (i = 0; i < urls.length; i++) {
173
                    URL url = urls[i];
174
                    extraInfo.append(url.toString()).append(",\n");
175
                }
176
                log.warn(extraInfo);
177
            }
178
            ClassLoader parent = ucl.getParent();
179
            if (null != parent) {
180
                if (!parent.equals(ucl)) {
181
                    if (7 < antiRecursion) {
182
                        log.error("too many recursions");
183
                    } else {
184
                        antiRecursion++;
185
                        log.warn("\nParent " + antiRecursion + ":");
186
                        showClassPath(parent, antiRecursion, log);
187
                    }
188
                }
189
            }
190
        }
191
    }
149
192
150
    /**
193
    /**
151
     * Process the end of this element.
194
     * Process the end of this element.
(-)java/org/apache/catalina/loader/WebappClassLoader.java (-1 / +4 lines)
Lines 77-82 Link Here
77
import org.apache.naming.resources.ResourceAttributes;
77
import org.apache.naming.resources.ResourceAttributes;
78
import org.apache.tomcat.util.ExceptionUtils;
78
import org.apache.tomcat.util.ExceptionUtils;
79
import org.apache.tomcat.util.IntrospectionUtils;
79
import org.apache.tomcat.util.IntrospectionUtils;
80
import org.apache.tomcat.util.digester.ObjectCreateRule;
80
import org.apache.tomcat.util.res.StringManager;
81
import org.apache.tomcat.util.res.StringManager;
81
82
82
/**
83
/**
Lines 1711-1717 Link Here
1711
            }
1712
            }
1712
        }
1713
        }
1713
1714
1714
        throw new ClassNotFoundException(name);
1715
        ClassNotFoundException classNotFoundException = new ClassNotFoundException(name);
1716
        ObjectCreateRule.showClassPath(this, 0, log);
1717
		throw classNotFoundException;
1715
1718
1716
    }
1719
    }
1717
1720

Return to bug 55470