The class could not be found

java.lang.ClassNotFoundException
Javadoc
Thrown when an application tries to load in a class through its string name using:
  • The forName method in class Class.
  • The findSystemClass method in class ClassLoader .
  • The loadClass method in class ClassLoader.

but no definition for the class with the specified name could be found.

As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "optional exception that was raised while loading the class" that may be provided at construction time and accessed via the {@link #getException()} method is now known as the cause, and may be accessed via the {@link Throwable#getCause()} method, as well as the aforementioned "legacy method." @author unascribed @see java.lang.Class#forName(java.lang.String) @see java.lang.ClassLoader#findSystemClass(java.lang.String) @see java.lang.ClassLoader#loadClass(java.lang.String, boolean) @since JDK1.0

at java.net.URLClassLoader.findClass
(source)

Typical Exception Messages

  1. <No message>
  2. org/slf4j/LoggerFactory
  3. org/hibernate/query/ParameterMetadata
  4. Failed to load ApplicationContext
  5. org/codehaus/janino/ScriptEvaluator
  6. com.mysql.jdbc.Driver
  7. org/apache/commons/logging/LogFactory
  8. Cannot find class [weka.attributeSelection.InfoGainAttributeEval] for bean with name 'infogainAttributeEval' defined in class path resource [org/apache/ctakes/ytex/beans-kernel.xml]; nested exception is java.lang.ClassNotFoundException: weka.attributeSelection.InfoGainAttributeEval
  9. java.lang.reflect.InvocationTargetException
  10. com/google/common/base/Function

Specific cases

Solution

poroszd, 5 months ago

This error pattern looks similar to error pattern 88439.

However, in this case, we are sure that this happens when sun.misc.URLClassPath.getResource(String name, boolean check) returns null. Practically every exception that happens in getResource is handled by returning null.

External results for this pattern (6946)

  1. Stephen S.via Google Groups1 week ago
    com/esotericsoftware/kryo/Serializer at app.AppClass.execute
    Show stack trace
  2. Prabhu shanmughapriyanvia Google Groups1 week ago
    org/springframework/context/ApplicationContextInitializer
    Show stack trace
  3. Unknown authorvia Google Groups1 week ago
    com/carrotsearch/hppc/ObjectContainer
    Show stack trace
  4. Unknown authorvia Google Groups1 week ago
    scala/runtime/Nothing$
    Show stack trace
  5. Pramod A Gvia Google Groups1 week ago
  6. Rasoul Firozvia Google Groups1 week ago
    Could not create transcoder factory.
    Show stack trace
  7. Spiro Pantazatosvia Google Groups1 week ago
  8. Jianwei-Wu-1via GitHub1 week ago
    cannot load class: spoon.reflect.annotations.PropertySetter
    Show stack trace
  9. pallenvia Google Groups1 week ago
    hudson/slaves/CommandLauncher
    Show stack trace