WebLogic Tips #3 – Missing Weblogic WrapperImpl

I was running a JUnit Test on a code that accessed data from a database via a stored proceudre. The output of the stored proc is an Oracle Type object. It threw the following error:

java.lang.NoClassDefFoundError: weblogic/utils/wrapper/WrapperImpl
…. (application related methods)…

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

But the same use case worked fine within the web environment. Turns out that the missing jar was com.bea.core.utils.wrapper- Add this to your test classes or if you are using Maven – add it to pom.xml in test scope:


Weblogic Tips #2

Issue: Your JSP containing JSTL running under Weblogic 10.3 gives the following error:

“weblogic.xml.jaxp.RegistrySAXParserFactory cannot be cast to javax.xml.parsers.SAXParserFactory”

Solution:Ensure xml-apis-1.3.03 is not present after the Maven build or remove it from the WEB-INF/lib.

Weblogic Tips #1

Weblogic throws NoClassDefFoundError: weblogic.util.NestedUtilException

Environment: WebLogic 10.3

Parsing xml in a standalone mode (out of weblogic 10.3 container) but app has dependency on weblogic.jar file.

If you are trying to run an application (say test case) in standalone mode (ie outside Weblogic container) and you have a dependency on weblogic.jar file, xml parsing might end up throwing the NoClassDefFoundError: weblogic.util.NestedUtilException (For eg loading log4j.xml via DOMConfigurator).

WebLogic has a RegistryXmlParserDocumentBuilderFactory class which may come in between the classpath if you are trying to parse an xml. This in turn depends on several other weblogic modules, not all of which will be in classpath. So you end up getting the NestedUtilException which gobbles up the actual error.

Set the -Djava.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl value in the jvm arguments.