jar hell检测

 

 

package common;

import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
/**
 * jar包冲突问题检测
 * 转自我们团队博客:http://mmtblog.sinaapp.com/?p=227
 * @author zw
 * @date 2013-4-16
 */
public class JarHell {
	public static void main(String[] args) {
	    try {
	        Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources("org/apache/log4j/Logger.class");
	        while(urls.hasMoreElements()) {
	            URL url = urls.nextElement();
	            System.out.println(url);
	        }
	    } catch (IOException e) {
	        e.printStackTrace();
	    }
	 
	}
}

 结果:jar:file:/D:/mmt/workspace/thrillerzwtest/lib/memcached/log4j-1.2.15.jar!/org/ap

ache/log4j/Logger.class

jar:file:/D:/mmt/workspace/thrillerzwtest/lib/axis2/log4j-1.2.15.jar!/org/apache

/log4j/Logger.class

 

你可能感兴趣的:(jar)