tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Tomcat diagnostics
Date Fri, 15 Oct 2010 19:00:28 GMT

A late comment on this thread.

On 9/25/2010 10:10 AM, Pid wrote:
> A user asked if it was possible for Tomcat to
> detect duplicate classes in the classpath and report which jar they were in.

I suppose Tomcat could be instructed to do this, but it would have to
step outside of the ClassLoader scheme and do everything manually:

1. Enumerate all the JAR files that would be in the ClassLoader's classpath

2. Open each JAR file (probably using java.util.Zip)

3. Scan each file and take a fingerprint (file length + SHA1 hash?, or
is it enough to just have the same FQCN?)

4. Compare all fingerprints

You can't use a ClassLoader directly because it will find the first
matching Class and ignore the rest. It also won't provide anything that
you can fingerprint (except maybe a list of methods/fields/etc.).


View raw message