3

i have created one jsp file but it doesn't running in any way..!!

it gives NoClassDefFoundError and ServletException.

here is the complete error message.

    javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jasper.compiler.JspUtil
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

I am using Eclipse Helios SR1 and Apache Tomcat 6.0, with JDK 1.6.0.

sohel khalifa
  • 5,602
  • 3
  • 34
  • 46

1 Answers1

5

i have saved servlet-api.jar and jsp-api.jar in WebContent\WEB-INF\lib folder..is it sufficient??

No. Remove them. If necessary, reconfigure your Eclipse project to set Tomcat as Targeted Runtime.

Read this thoroughly: How do I import the javax.servlet API in my Eclipse project? Dropping arbitrary servlet container specific libraries in /WEB-INF/lib is one of most common beginner's mistakes in order to "solve" compilation problems on JSP/Servlet specific APIs which they faced in an IDE. It would make your webapp to run correctly only on the container where those libraries originated from, not on containers of different makes/versions.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555