1

I'm creating an application where I'm getting the error shown below.

I'm using Tomcat 6.0 and Spring 3.0.

SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.VerifyError: (class: org/apache/jasper/compiler/JspUtil, method: <clinit> signature: ()V) Incompatible argument to function
at org.apache.jasper.JspCompilationContext.getServletClassName(JspCompilationContext.java:371)
at org.apache.jasper.JspCompilationContext.getClassFileName(JspCompilationContext.java:511)
at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:445)
at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:392)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:582)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:636)

Please let me know if any other details are required...

**NOTE: The same application was working earlier using a Java EE server. Now I have changed it to Tomcat instead of this Java EE server.

Thanks in advance and let me know if I am missing anything.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276

2 Answers2

4

This indicates that you have servlet container specific libraries like jsp-api.jar in your webapp's /WEB-INF/lib. This is not right. Remove them all. Your webapp's /WEB-INF/lib should contain only the libraries which are specific to the webapp itself, not to the target server. The target server has those libraries already in its own /lib folder and they should be kept untouched and for sure not be copied/moved around.

Incorrectly copying/placing servlet container specific libraries in /WEB-INF/lib is a pretty common beginner's mistake while they are blindly looking for a solution/workaround for the JSP/Servlet-related compilation errors they got in their IDE.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Still same error... :( Below are jar files I have in WEB-INF/lib `commons-logging-1.1.1, jasper, javaee, javax.el, jstl-1.1.2, junit-4.3.1, mysql-connector-java-5.0.5, org.springframework.asm-3.0.1.RELEASE-A, org.springframework.beans-3.0.1.RELEASE-A, org.springframework.context-3.0.1.RELEASE-A, org.springframework.core-3.0.1.RELEASE-A, org.springframework.expression-3.0.1.RELEASE-A, org.springframework.web.servlet-3.0.1.RELEASE-A, org.springframework.web-3.0.1.RELEASE-A, standard` – Fahim Parkar Jan 11 '12 at 15:08
  • The `jasper`, `javax.el` and `javaee` are container-specific. Remove them as well. Your particular problem is caused by the `jasper` one. – BalusC Jan 11 '12 at 15:10
  • Below is what I have in tomcat lib folder `annotations-api, catalina, catalina-ant, catalina-ha, catalina-tribes, el-api, jasper, jasper-el, jasper-jdt, jsp-api-2.1-6.0.2, servlet-api, tomcat-coyote, tomcat-dbcp, tomcat-i18n-es, tomcat-i18n-fr, tomcat-i18n-ja` – Fahim Parkar Jan 11 '12 at 15:10
  • You must **untouch** the Tomcat lib! Never move/copy those libs into your webapp. – BalusC Jan 11 '12 at 15:10
  • No changes still made to tomcat lib :) – Fahim Parkar Jan 11 '12 at 15:11
  • That's fine, but the problem indicates that you copied them into your webapp's lib. Have you by the way already read the "See also" link? Do you *understand* the underlying problem/mistake? – BalusC Jan 11 '12 at 15:14
  • Yep I got the problem & gone through the See also link... `You should above all never manually copy/download/move/include the individual servletcontainer-specific libraries like servlet-api.jar, jsp-api.jar, el-api.jar, j2ee.jar, javaee.jar, etc. It would only lead to future portability, compatibility, classpath and maintainability troubles, because your webapp would not work when it's deployed to a servletcontainer of a different make/version than where those libraries are originally obtained from.` – Fahim Parkar Jan 11 '12 at 15:17
1

java.lang.VerifyError happens when you have compiled against a different Jar than you are using at runtime.

Tomcat might have wrong version of apache Jars (could be older/newer version) based on error class: org/apache/jasper/compiler/JspUtil. Please make sure you have correct Jars in classpath.

kosa
  • 65,990
  • 13
  • 130
  • 167
  • means I should keep new/updated jar files that are inside `apache-tomcat-6.0.26/lib`.. correct?? – Fahim Parkar Jan 11 '12 at 14:50
  • Please let me which jar files do I need to update... Below are what I have in `/home/fparkar/Backup/temp/Spring-jar/` `annotations-api, catalina, catalina-ant, catalina-ha, catalina-tribes, el-api, jasper, jasper-el, jasper-jdt, jsp-api-2.1-6.0.2, servlet-api, tomcat-coyote, tomcat-dbcp, tomcat-i18n-es, tomcat-i18n-fr, tomcat-i18n-ja` – Fahim Parkar Jan 11 '12 at 14:53
  • In otherwords, you need to have same jars you referenced in your project setup. – kosa Jan 11 '12 at 14:53
  • means the files that are in WEB-INF/lib should be in tomcatlib too? – Fahim Parkar Jan 11 '12 at 14:55
  • as BalusC said remove that file from your WEB-INF lib. It should resolve the issue. – kosa Jan 11 '12 at 14:57