Weblogic Tips #1

Weblogic throws NoClassDefFoundError: weblogic.util.NestedUtilException

Environment: WebLogic 10.3

Symptoms
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.

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

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: