Failed to load a class specified by the class name as a string

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$1.run
at java.net.URLClassLoader$1.run
at java.security.AccessController.doPrivileged
(source)
at java.net.URLClassLoader.findClass
(source)
at java.lang.ClassLoader.loadClass
(source)
at sun.misc.Launcher$AppClassLoader.loadClass
(source)
at java.lang.ClassLoader.loadClass
(source)
at java.lang.Class.forName0
(source)
at java.lang.Class.forName
(source)
8 frames hidden

Typical Exception Messages

  1. com.mysql.jdbc.Driver
  2. org.postgresql.Driver
  3. mypackage.MyClass
  4. com.eviware.soapui.plugins.auto.factories.AutoImportMethodFactory
  5. com.microsoft.sqlserver.jdbc.SQLServerDriver
  6. org.apache.mahout.math.Vector
  7. oracle.jdbc.driver.OracleDriver
  8. sun.jdbc.odbc.JdbcOdbcDriver
  9. org.sqlite.JDBC
  10. oracle.jdbc.OracleDriver

Origin

Class.forName0() has thrown a ClassNotFoundException

java.lang.ClassNotFoundException
7 frames hidden
java.lang.Class.forName0
837Web pages

Specific cases

Solution

poroszd, 4 months ago

Check the exception message to find out what is the name of the class that could not be found. It might be misspelled and you have to fix it in a config file. If the name is correct, you have to fix your classpath.

External results for this pattern (831)

  1. bouteillvia GitHub2 weeks ago
    com.martiansoftware.nailgun.examples.HelloWorld
    Show stack trace
  2. com.eviware.soapui.plugins.auto.factories.AutoDiscoveryMethodFactory
    Show stack trace
  3. xf0516via GitHub1 month ago
    endpoint
    Show stack trace
  4. com.mysql.cj.jdbc.Driver
    Show stack trace
  5. klion26via Stack Overflow1 month ago
    com.alibaba.otter.canal.protocol.CanalEntry$Entry
    Show stack trace
  6. Unknown authorvia search-hadoop.com1 month ago
  7. Unknown authorvia search-hadoop.com1 month ago