You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/09/25 10:06:59 UTC

[Bug 57019] New: Tomcat cannot find new JSP

https://issues.apache.org/bugzilla/show_bug.cgi?id=57019

            Bug ID: 57019
           Summary: Tomcat cannot find new JSP
           Product: Tomcat 8
           Version: 8.0.12
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: misc@fctwente.net

Created attachment 32055
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32055&action=edit
Sample application reproducing the error

We have a webapplication that retrieves templates from a database. On a page
request a template is fetched from the database, written to the filesystem as
JSP and the request is forwarded to the JSP. This has worked without problems
on older versions of Tomcat, but since Tomcat 8 this results in the following
exception:

SEVERE: Servlet.service() for servlet [test.TestServlet] in context with path
[/DynamicJSPTester] threw exception [File "/1411630997360.jsp" not
found] with root cause
javax.servlet.ServletException: File "/1411630997360.jsp" not found
    at
org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:413)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
    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.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
    at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
    at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:523)
    at test.TestServlet.doGet(TestServlet.java:42)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
    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)

It seems to have something to do with a Cache, as this is the stack that tries
to retrieve the resource:

Cache.getResource(String, boolean) line: 62    
StandardRoot.getResource(String, boolean, boolean) line: 216    
StandardRoot.getResource(String) line: 206    
ApplicationContext.getResource(String) line: 533    
ApplicationContextFacade.getResource(String) line: 199    
JspServlet.serviceJspFile(HttpServletRequest, HttpServletResponse, String,
boolean) line: 379    
JspServlet.service(HttpServletRequest, HttpServletResponse) line: 335    
JspServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 725    
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line:
291    
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206    
ApplicationDispatcher.invoke(ServletRequest, ServletResponse,
ApplicationDispatcher$State) line: 721    
ApplicationDispatcher.doInclude(ServletRequest, ServletResponse) line: 584    
ApplicationDispatcher.include(ServletRequest, ServletResponse) line: 523    
TestServlet.doGet(HttpServletRequest, HttpServletResponse) line: 42    

Environment:

Apache Tomcat/8.0.12
Connector: http-nio-8082
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
Microsoft Windows [Version 6.3.9600]

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 57019] Tomcat cannot find new JSP

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57019

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
One more thing. I forgot to say thanks for the quality of the report and for
providing a test case.

The bug might have been invalid that doesn't change the fact that it was well
written, clearly described the problem at hand and came with a test case that
was always going to be trivial for a developer to get working. If all bug
reports were of this standard, my life would be a lot easier.

As an aside, some good did come of this. I fixed the problem that was causing
&quot; to appear in the error page output.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 57019] Tomcat cannot find new JSP

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57019

Richard <mi...@fctwente.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 57019] Tomcat cannot find new JSP

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57019

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
You are correct that the caching is what is getting in the way. The
getRealPath() call you use to construct the path to write to triggers a lookup.
The result that the file does not exist is then cached.

Disabling the cache will fix your issue. The problem you are seeing is because
you are trying to do this using Tomcat 7 configuration settings rather than
Tomcat 8 configuration. You need to read the migration guide:
http://tomcat.apache.org/migration-8.html#Web_application_resources

I also have a couple of suggestions.

1. Leave caching enabled, use getRealPath("/") and the append the file name to
the result. That way you get to keep the benefit of the cache.

2. HttpServletRequest.getSession().getServletContext() is longer winded than it
needs to be. You could use HttpServletRequest.getServletContext() as of Servlet
3.0 (Tomcat 7).

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 57019] Tomcat cannot find new JSP

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57019

--- Comment #1 from Richard <mi...@fctwente.net> ---
I also tried the 'cachingAllowed=false' attribute in the context.xml, but that
doesn't solve the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org