August 3, 2009

JSP: Syntax error on tokens, delete these tokens

Topic:  JSP 2.0

Application Server: JBoss 4.0.2 / Tomcat 5.5.9

Exception:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 1 in the jsp file: /Test.jsp
Generated servlet error:
Syntax error on tokens, delete these tokens

 org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
 org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
 org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)

Resolution:

This Exception indicates a syntax error in a JSP Scripting element. In this particular example, a whitespace between the % and the @ characters of the JSP page directive caused the exception to be thrown.

Check the JSP directives as well as other JSP elements and make sure there are no spaces between the % and the respective element characters, as well as other JSP syntax is intact.

No comments:

Post a Comment