Saturday, April 7, 2012

How to find WebLogic classpath? How to compare the JARs in 2 installations?

a) install XMing, run putty with X11 forwarding, run JConsole or VisualVM, connect to the WebLogic instance (you must find out the PID), look in System Properties java.class.path

b) grep java.class.path in the logs

c) if you have JRockit, use:

jrcmd ${pid} print_properties | grep java.class.path | awk -F'=' '{print $2}'



d) if you have Sun (Oracle?) run

jinfo -sysprops ${pid} | grep java.class.path | awk -F'=' '{print $2}'

(jinfo is pretty much equivalent to the great jrcmd command, see here )


see also http://www.javamonamour.org/2010/09/sanity-check-on-weblogic-classpath.html


To dump the JARs in the classpath:


pid=$1
entries=`jinfo -sysprops ${pid} | grep java.class.path | awk -F'=' '{print $2}' | tr ':' '\n' | sort`
entriesList=(${entries})
for i in `seq 0 $((${#entriesList[@]}-1))`;
do
  entry=${entriesList[$i]}
  if [ -f ${entry} ]
    then ls -ltr ${entry}
  fi
done




To compare 2 installations:

run this on both envs:

cd /opt/oracle/fmw11_1_1_5/
find . -name *.jar | sort | xargs ls -ltr > /tmp/alljars1.txt



and then use BeyondCompare to compare the 2 alljars1.txt files...


Another way is witl WLST:

connect(...)
serverRuntime()
ls()
look at ServerClasspath



No comments: