Re: Tomcat Internal Architect for JSP compilation?

2024-03-26 Thread Subodh Joshi
Thanks Chris & others for your input,

I am planning to do same now and may be we will use the property

*server.tomcat.basedir*

But this may create another issue ,it will grow the size of the folder . Is
this possible in the coming release tomcat/embedded tomcat give a feature
to delete the basedir at the tomcat restart/start and recreate it?

One more thing is unanswered after deleting the tomcat folder why first
page clicked is throwing 500 error with ClassNotFoundException if its not
accessed before deleting the tomcat folder?

On Fri, Mar 22, 2024 at 7:01 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> 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.Ex

Re: Tomcat Internal Architect for JSP compilation?

2024-03-26 Thread Christopher Schultz

Subodh,

On 3/26/24 06:59, Subodh Joshi wrote:

I am planning to do same now and may be we will use the property

*server.tomcat.basedir*

But this may create another issue ,it will grow the size of the folder.


What makes you say that?


Is this possible in the coming release tomcat/embedded tomcat give a
feature to delete the basedir at the tomcat restart/start and
recreate it?


This sounds more like a deployment detail and not a Tomcat-launch 
detail. Since you are using Spring Boot, why not just delete the 
directory from your own code before Tomcat launches?



One more thing is unanswered after deleting the tomcat folder why first
page clicked is throwing 500 error with ClassNotFoundException if its not
accessed before deleting the tomcat folder?


I'm sorry, I can't answer that without spending a lot of time looking at 
your environmemnt.


If you stop deleting the directory while Tomcat is running and it stops 
returning 500 responses, then I think you have solved your problem 
without discovering the absolute root-cause of the problem. But you are 
pulling the rug out from underneath a running application and expecting 
it to work without failing. I think that's not a realistic expectation. 
Tomcat relies on its local environment being stable. Dont' destabilize it.


If you absolutely need Tomcat to not-fail under thes conditions, we'd be 
happy to have you research it and provide a patch or pull-request.


-chris


On Fri, Mar 22, 2024 at 7:01 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


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




or