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

Source: Internet
Author: User
Tags stack trace apache tomcat

Jump to. JSP file in controller error: Unable to compile class for JSP

Severity: Servlet.service () forservlet JSP threw exceptionorg.apache.jasper.JasperException:Unable to compile class for JSP: An error occurred on line: [14] In the generated Java file: [C:\Users\Admin\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work \catalina\localhost\springdemo\org\apache\jsp\web_002dinf\contents\front\news_jsp.java]only a type can be imported. View. News resolves to a Packagestacktrace:at org.apache.jasper.compiler.DefaultErrorHandler.javacError (Defaulterrorhandler.java:103) at Org.apache.jasper.compiler.ErrorDispatcher.javacError (Errordispatcher.java:366) at Org.apache.jasper.compiler.JDTCompiler.generateClass (Jdtcompiler.java:490) at Org.apache.jasper.compiler.Compiler.compile (Compiler.java:379) at Org.apache.jasper.compiler.Compiler.compile (Compiler.java:354) at Org.apache.jasper.compiler.Compiler.compile (Compiler.java:341) Org.apache.jasper.JspCompilationContext.compile (Jspcompilationcontext.java:36W) Org.apache.jasper.servlet.JspServletWrapper.service (Jspservletwrapper.java:364) Org.apache.jasper.servlet.JspServlet.serviceJspFile (Jspservlet.java:395) Org.apache.jasper.servlet.JspServlet.service (Jspservlet.java:339) Javax.servlet.http.HttpServlet.service (Httpservlet.java:731) Org.apache.tomcat.websocket.server.WsFilter.doFilter (Wsfilter.java:52) Org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel ( Internalresourceview.java:168) Org.springframework.web.servlet.view.AbstractView.render (Abstractview.java:303) Org.springframework.web.servlet.DispatcherServlet.render (Dispatcherservlet.java:1282) Org.springframework.web.servlet.DispatcherServlet.processDispatchResult (Dispatcherservlet.java:1037) Org.springframework.web.servlet.DispatcherServlet.doDispatch (Dispatcherservlet.java:980) Org.springframework.web.servlet.DispatcherServlet.doService (Dispatcherservlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest (Frameworkservlet.java:970) Org.springframework.web.servlet.FrameworkServlet.doGet (Frameworkservlet.java:861) Javax.servlet.http.HttpServlet.service (Httpservlet.java:624) Org.springframework.web.servlet.FrameworkServlet.service (Frameworkservlet.java:846) Javax.servlet.http.HttpServlet.service (Httpservlet.java:731) Org.apache.tomcat.websocket.server.WsFilter.doFilter (Wsfilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (Characterencodingfilter.java: 197) Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107Note the full stack trace of the root cause are available in the Apache Tomcat/7.0.78 logs.

Most of the reasons for online search are
1. JDK and Tomcat versions do not correspond
2. Javax.servlet.jar and Javax.servlet.jsp.jar, etc. package repetition
But the previous page can be run normally, only this one interface cannot request, conjecture should not be the above problem. And then found that the. jsp file was not compiled, so it should be something in the JSP page that caused the. JSP page was not compiled.


Later inspired by the stack overflow, Here is the problem with the format of the. java file that is imported into the JSP. What wrong file did the JSP introduce, the discovery introduced a nonexistent. java file: Domain.News.java, just delete this quote. Since the previous code is copied directly, forget to delete the referenced file

Because the JSP nature is a servlet. When the JSP is first requested, the JSP is interpreted by the container as the servlet source code, automatically compiled into a. class file, loaded into a. class file, and then a Servlet object is generated.

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.