1

I am getting below error on AWS box when deploying on tomcat8. In my local system on tomcat8, it works fine.

type Exception report

message Servlet execution threw an exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

java.lang.NoClassDefFoundError: Could not initialize class org.springframework.web.context.request.ServletRequestAttributes
    org.springframework.web.servlet.FrameworkServlet.buildRequestAttributes(FrameworkServlet.java:996)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:923)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

My Tomcat lib dir enter image description here

Ankur Singhal
  • 26,012
  • 16
  • 82
  • 116
  • did you added jars in deployment descriptor? –  Sep 28 '16 at 10:30
  • @HelloWorld where exactly in `deployment descriptor`, i have spring related jars inside `web-inf/lib` – Ankur Singhal Sep 28 '16 at 10:33
  • 1
    did you add the spring web jar in the tomcat lib folder ? Please remove it. That jar should already be there in web app classpath. – s7vr Sep 28 '16 at 10:35
  • `build path>configure build paty>click on deployment assembly>add>java build path entries(select all click ok)` its worth a shot –  Sep 28 '16 at 10:35
  • and yes remove jar from `tomcat` –  Sep 28 '16 at 10:36
  • `NoClassDefFoundError` means that you have loaded different spring versions in your classpath. Could you post your maven pom or gradle configuration , or at least which spring jars are you deploying – AntJavaDev Sep 28 '16 at 10:37
  • @AntJavaDev it means your application cannot read the jar and in `web application` it happens if your deployment descriptor is missing jars to deploy with –  Sep 28 '16 at 10:44
  • @HelloWorld , you can try it locally , deploy a Spring Web App in Tomcat without the related jars , youll get a `ClassNotFoundException` , now deploy 2 versions of spring F.E. 3.2.5 and 4.2.0 , you ll get a `MethodNotFoundException` or a `NoClassDefFoundError` because at RunTime the JVM cannot decide which version to load. Read this answer [here](http://stackoverflow.com/questions/1457863/what-causes-and-what-are-the-differences-between-noclassdeffounderror-and-classn) for more details – AntJavaDev Sep 28 '16 at 10:58

0 Answers0