How To Find Missing Class While ClassNotFound Exception Encountered (Doc ID 1358623.1)

Last updated on JULY 07, 2017

Applies to:

Oracle WebLogic Server - Version 9.0 and later
Oracle Containers for J2EE - Version 10.1.2.0.0 and later
Information in this document applies to any platform.
Add ***Checked for relevance on 07-Mar-2013***
Checked for relevancy on 13-Aug-2014

Goal

It is common to see the ClassNotFound exception when deploy an application or when run an application, however, the exception java stack trace (see below as example) can only indicate the name of the missing class but will not tell where is the location of the corresponding library such as .jar/.war/.zip for the missing class. That brings inconvenience to resolve the issue.


java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)



When the issue occurs in Linux/Unix, one may implement some shell script to search jars to find the missing class, however, that may not be feasible in other platform such as Window, further that will make difficulty to those users without shell script skill.

This note is about to provide a cross platform solution to find the corresponding libraries which contains the missing class, it is simple to use in many environment as long as the java is available in the environment.

In fact, the solution is a java based program, which allows to recursively search an entire given path and its sub-folders  for a missing class.

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms