How to resolve Tomcat java.lang.NoClassDefFoundError exception

I’m recently working on a large online website and using Tomcat in development phase, I broke the tomcat so that I got the NoClassDefFoundError exception. Here is the stack trace of NoClassDefFoundError.

at org.apache.catalina.loader.WebappClassLoader.loadClass(
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
at SecurePaymentAjaxData.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(

When ClassNotFoundException is occurring, this is to say that the class loader is not able to find the class binary file in webapp classpath (the jars in mywebapp/WEB-INF/lib). Same situation also happens to NoClassDefFoundError. If you have same issue it is strongly recommended you follow the below:

  1. Check whether or not the required Jar is listed in WEB-INF/lib folder of your WAR? If not add it.
  2. If the Jar has included in classpath, check whether the class exists in this Jar package.
  3. Try to restart tomcat.
Оцените статью
Добавить комментарий

Your email address will not be published. Required fields are marked *



  1. Anuja

    What does it mean: If the Jar has included in classpath, check whether or not the class within the JAR.

    1. admin автор

      if your Jar has included in classpath(or have existed in WEB-INF/lib) and you also got NoClassDefFoundError exception, perhaps the class didn’t include within the Jar. so you need check it.

      For example. we have got NoClassDefFoundError FileUtil exception, commonly FileUtil.class should be within apache common-io.jar. first of all you need to check that common-io.jar has really existed WEB-INF/lib directory(tomcat lib dir), next, if you still got the NoClassDefFoundError FileUtil exception, you may check the class FileUtil is really included within Jar common-io.jar.

  2. aladeck

    I don’t have same problem.
    my problem:
    Normal, system run without exception “java.lang.NoClassDefFoundError”. But some time, we receive this exception.
    After restart Tomcat, system is returned to normal state.
    I think our system has problem with memory.

  3. Gonzalo Oviedo

    See StackOverflow, they are amazing, you have to do with Eclipse: go to Properties of the WebProject and go to Assembly. Put your dependency project there!.