Subodh,

On 3/22/24 01:36, Subodh Joshi wrote:
Hi Chris

Thanks for your response.

So i added below properties in application.properties file

spring.mvc.cache-control.cache-allowed=false

and then Deleted the /tmp/tomcat directory . So now when i restart the
server A.jsp only fail with 500 error (ClassNotFoundException) as this is
first page which i was trying to load, rest JSP pages working fine without
any issue .

Why i am doing this exercise?
In our some of the deployed linux environment many clients are complaining
about this issue , We tried to monitor who actually deleting these
/tmp/tomcat folder but still we are not able to figure it out and we are
not able to reproduce it . So i have to do reproduce it manually deleting
the /tmp/tomcat directory.

What if you don't use /tmp as your work directory location? /tmp is supposed to be for actually temporary files. These files could live for decades if you never changed your source .jsp files or re-deployed your application.

-chris

On Thu, Mar 21, 2024 at 7:24 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

Subudh,

On 3/21/24 07:32, Subodh Joshi wrote:
   Expert,

Recently i came across a issue and i was getting no clue what was going
on
wrong with the Application.

So here is the issue , we were getting following issue in our web
application(Springboot+Embedded Tomcat) which is deployed into Linux
machine

java.lang.ClassNotFoundException:
org.apache.jsp.WEB_002dINF.jsp.ImportTab_jsp
          at
java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
          at
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:129)
          at
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:58)
          at

org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:151)
          at

org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:189)
          at

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:410)
          at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
          at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
          at
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
          at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205)
          at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
          at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
          at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
          at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
          at

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:110)
          at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
          at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
          at

org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:108)
          at

org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231)
          at

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365)
          at

org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100)
          at

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
          at

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
          at

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
          at

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
          at

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
          at

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
          at

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179)
          at

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
          at

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
          at

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
          at

com.comptel.catalog.support.filter.OperationClientRestFilter.doFilter(OperationClientRestFilter.java:86)
          at

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
          at

com.comptel.catalog.support.filter.JwtSecurityChainFilter.doFilter(JwtSecurityChainFilter.java:100)
          at

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)


but how to reproduce this issue we were not able to get any clue.

But Recently i got to know how to reproduce this issue
1- Start the web-application.
2- Tomcat will create a directory under /tmp/tomcat.*/.././......
3- Now access web-application through browser.
4- But dont access all JSP pages.
5- Suppose application have A,B,C,D.jsp pages .
6- User accesses A,B.jsp only
7- Now user or any cron job deleted /tmp/tomcat directory

Don't do that.

8- Now user click on C.jsp it is throwing above given exception.
9- Now click on D.jsp it will work fine as tomcat will create /tmp/tomcat
..... directory again.
10. But C.jsp which was failed with 500 error will never come upto the
time
tomcat will not start.

Can someone please explain how tomcat works here and why it throws an
exception and wont allow that jsp page to come up without restart?

Tomcat is caching resources and does not expect another process to come
around and delete its files. I'm not sure exactly why the C.jsp/C.class
file ends up getting "stuck" while D.jsp/D.class does not.

You vould try setting cachingAllowed="false" in your <Resources> element
in META-INF/context.xml (or embedded equivalent) to disable caching.
Performance will likely suffer, but perhaps it will reolve this issue.

Why not just _stop deleting Tomcat's work directory_?

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to