Bug 57020 - Error while compiling JSPs: "The method getDispatcherType() is undefined for the type HttpServletRequest"
Summary: Error while compiling JSPs: "The method getDispatcherType() is undefined for ...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 8.0.12
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-25 18:03 UTC by Jesper de Jong
Modified: 2014-10-02 07:30 UTC (History)
0 users



Attachments
Log file (11.05 KB, text/plain)
2014-09-25 18:03 UTC, Jesper de Jong
Details
JSP Java file (3.61 KB, text/plain)
2014-09-25 18:05 UTC, Jesper de Jong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesper de Jong 2014-09-25 18:03:24 UTC
Created attachment 32057 [details]
Log file

I have a very simple (almost empty, I'm just starting a project) Java webapp that uses the Servlet 3.1 API.

I currently have a single JSP with only static HTML code.

When I deply and run my webapp on Tomcat 8.0.12, I get a compile error in the JSP. Note: This works correctly on Tomcat 8.0.11. It seems to be an issue introduced in 8.0.12.

25-Sep-2014 19:53:14.726 SEVERE [http-nio-8080-exec-1] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet jsp threw exception
 org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [42] in the generated java file: [C:\Users\Jesper\.IntelliJIdea13\system\tomcat\Unnamed_spring-webmvc-thymeleaf_3\work\Catalina\localhost\ROOT\org\apache\jsp\WEB_002dINF\jsp\welcome_jsp.java]
The method getDispatcherType() is undefined for the type HttpServletRequest

Stacktrace:
	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
	at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:446)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:361)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:335)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:172)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228)
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:534)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
	at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Comment 1 Jesper de Jong 2014-09-25 18:05:14 UTC
Created attachment 32058 [details]
JSP Java file
Comment 2 Mark Thomas 2014-09-25 18:17:10 UTC
You have a problem with your dev environment. This doesn't happen with a clean Tomcat install and HttpServletRequest.getDispatcherType() is a valid method.
Comment 3 Jesper de Jong 2014-09-25 18:46:51 UTC
I know that HttpServletRequest.getDispatcherType() is a valid method, it's a new method in the Servlet 3.0 API.

I created a new project with a minimal setup to try to reproduce the problem, but it now works as expected. I threw away my IDE-specific project files and re-imported the project from the Maven pom.xml, and threw away the Tomcat configurations in IntelliJ.

The problem went away.

Apparently there was indeed something wrong with my development environment setup.

Thanks and sorry for the inconvenience.
Comment 4 Pavel Cibulka 2014-10-02 07:30:38 UTC
I have same problem with package:

                            <dependency>
                                <groupId>javax.servlet.jsp.jstl</groupId>
                                <artifactId>jstl-api</artifactId>
                                <version>1.2-rev-1</version>
                                <exclusions>
                                    <exclusion>
                                        <groupId>javax.servlet</groupId>
                                        <artifactId>servlet-api</artifactId>
                                    </exclusion>
                                    <exclusion>
                                        <groupId>javax.servlet.jsp</groupId>
                                        <artifactId>jsp-api</artifactId>
                                    </exclusion>
                                </exclusions>
                            </dependency>

I have changed version to <version>1.2</version> and it is working fine now.