You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2010/10/15 21:00:28 UTC
Re: Tomcat diagnostics
Pid,
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.).
-chris