Showing posts with label WebLogic. Show all posts
Showing posts with label WebLogic. Show all posts

How to find out which jar file a class is loaded from

There are ways to programmatically find out where the java classloader loads a certain class from. But what if you don't have access to the source code and are on a production environment.
In these cases JVM provides you with a nice option :
-verbose:class

So if you are working with a an app server like WebLogic or Tomcat, just modify the appropriate script that sets JVM arguments and you should be able to see output like this in your server log :

 [Loaded java.io.Serializable from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.Comparable from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.CharSequence from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
..............................................................................
..............................................................................
..............................................................................

How to combine find and zip to compress WebLogic ADR directories

Weblogic Server has an ADR folder containing a sub directory called incident. This directory holds one directory for each incident that happens during an application lifetime.

Each of these individual incident folder can be several Mega Bytes so i use the following to zip them up and delete them. I set it as a cron to run every 5 minutes.

find /MW_HOME/user_projects/domains/my_domain/servers/AdminServer/adr/diag/ofm/apps/myapp/incident  -iname "incdir_*" -type d -exec sh -c 'zip -r {}.zip {}' \; -exec rm -rf {} \;