Given a class name, how to identify where it is loaded from in JBoss AS 5.1.0?
I am looking for a JMX kind of option in JBoss 5.1.0 to find the jar file/location of the jar file/class loader for given a fully qualified 开发者_开发百科class name at run time. This is to understand what class loader configuration are in place across applications in a deployment.
It's not really a "JMX kind of option" but maybe this can help you?
Following Java code can be executed to find out where your classes are loaded from:
ProtectionDomain protectionDomain = YourClass.class.getProtectionDomain();
File codeLoc = new File(protectionDomain.getCodeSource().getLocation().getFile());
See this dzone link.
精彩评论