How do I check which Jar file a class file belong to?

How do I check which Jar file a class file belong to?

Knowing a jar file where a stack trace originates from can be handy when troubleshooting for library conflict. If you want to find out, this can be easily done using user macros.

For example:

You can copy and paste the following code, which is the same as the screenshot above:

<pre>$action.getClass().getClassLoader().loadClass("org.apache.commons.lang.StringUtils").getProtectionDomain().toString()</pre>

If the macro is run, it will print the path of the loaded jar file in your application server ie. the above user macro will print the file path to the jar file where org.apache.commons.lang.StringUtils class belongs.

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport