Wednesday, September 4, 2013

OSB: Custom XPath vs Java Callout classloader difference

the Custom Xpath classloader doesn't access the jars in the domain lib folder (like /opt/oracle/domains/osbpl1do/lib folder), while the java callout does. So a function might work when invoked by JavaCallout, but give a nasty error from a customxpath:
 java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Hex
 at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(
 at weblogic.utils.classloaders.GenericClassLoader.findClass(
 at java.lang.ClassLoader.loadClass(
 at java.lang.ClassLoader.loadClass(
 at weblogic.utils.classloaders.GenericClassLoader.loadClass(

If you need some common libraries in a Custom Xpath, you better add the jar explicitly to the JVM classpath
vi /opt/oracle/domains/osbpl1do/bin/

restart your managed server
Check the JVM classpath:
pid="the managed server pid"
jinfo -sysprops ${pid} | grep java.class.path | awk -F'=' '{print $2}'

this gives me this new classpath:
....many more
....many more

For more on WebLogic classloader, see here

No comments: