You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Matt Bathje <mp...@ntsource.com> on 2005/01/13 18:27:40 UTC

Does tomcat cache compiled JSPs?

Hey everybody -

I am trying to get Tomcat to dynamically compile JSPs that are uploaded 
through a web interface. I am using the org.apache.jasper.JspC ant task 
trough code to do it.

After a bit of work, I am able to get the file parsed and compiled into 
the proper directory, which as far as I know is:
<TOMCAT_HOME>/work/Catalina/mysite/org/apache/jsp/WEB_INF/tiles/public/layouts/
(I got this based on the fact that if I update the .jsp file by hand and 
wait for the scheduled jasper compile, the file in this directory gets 
updated.)

Both the .class and the .java files are updated with a time stamp of 
right around when the upload occurred, and if I view source on the .java 
file, it contains whatever change I uploaded into the .jsp file, so 
everything seems like it should work.

When browsing the site though, the updated version of the file is not 
used. If I restart the site (either through manager stop/start or 
reload, or through restarting tomcat) the new file is then used. Waiting 
for the scheduled jasper compile does NOT recompile the file (as would 
be expected I think...) If I change the .jsp file by hand after my 
upload/compile process, and wait for the scheduled jasper compile, the 
hand-updated version of the file is used.

It seems as though I am missing something when I do my compile. I looked 
through the JspC (and related) code, and it seems as though if any files 
were changed, it reloads the JSPServlet, and this somehow makes the 
updated files be used.

So - I guess the questions I have are:
- Does tomcat cache the compiled JSPs somewhere?
- If so, how to reload that cache?
- Does that fact that the newly-compiled file is always called from a 
<jsp:include page="xxx.jsp" /> make a difference?
- Is there a way to use the "running" jsp compiler instead of using the 
JspC ant task - I think using the JSPServlet would solve all my problems 
actually, but I see no way to call it from my code.


Thanks,
Matt

PS - I am 99.9999% sure that this is not a browser/proxy caching issue. 
It happens on multiple browsers/computers, and I see no other caching 
issues on the site when changes are made, this is the only time/place.

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


Re: Does tomcat cache compiled JSPs?

Posted by Matt Bathje <mp...@ntsource.com>.
> is the jsp doing the <%@ include> being <jsp:include>-ed itself into
> another jsp?

It isn't being included, but it is being called as part of a 
struts/tiles definition.

> 
> also, are you using tomcat 5?  if you are i believe you can use EL to
> do something like:
> 
> <%@ include file="${your_object.dynamic_file_name}" %>
> 
> 

Doesn't seem to work:
2005-01-13 12:22:56 StandardContext[]Background compile failed
org.apache.jasper.JasperException: 
/WEB-INF/tiles/public/layouts/index.jsp(54,0) File 
"/WEB-INF/tiles/public/layouts/${pathToInclude}" not found

I didn't see anything in the JSP documentation that would indicate you 
can use EL in the include directive myself.


Matt

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


Re: Does tomcat cache compiled JSPs?

Posted by Woodchuck <wo...@yahoo.com>.
--- Matt Bathje <mp...@ntsource.com> wrote:

> Woodchuck wrote:
> > --- Matt Bathje <mp...@ntsource.com> wrote:
> > 
> > 
> > 
> >>- Does that fact that the newly-compiled file is always called from
> a
> >>
> >><jsp:include page="xxx.jsp" /> make a difference?
> > 
> > 
> > try <%@ include file="xxx.jsp" %>
> > 
> > 
> 
> This would not be an ideal situation as the path to include is 
> dynamically calculated - but in any case, I tried hard-coding it and 
> doing the include, and it did not help the situation any.
> 

is the jsp doing the <%@ include> being <jsp:include>-ed itself into
another jsp?

also, are you using tomcat 5?  if you are i believe you can use EL to
do something like:

<%@ include file="${your_object.dynamic_file_name}" %>


> 
> Matt
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

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


Re: Does tomcat cache compiled JSPs?

Posted by Matt Bathje <mp...@ntsource.com>.
Woodchuck wrote:
> --- Matt Bathje <mp...@ntsource.com> wrote:
> 
> 
> 
>>- Does that fact that the newly-compiled file is always called from a
>>
>><jsp:include page="xxx.jsp" /> make a difference?
> 
> 
> try <%@ include file="xxx.jsp" %>
> 
> 

This would not be an ideal situation as the path to include is 
dynamically calculated - but in any case, I tried hard-coding it and 
doing the include, and it did not help the situation any.


Matt

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


Re: Does tomcat cache compiled JSPs?

Posted by Woodchuck <wo...@yahoo.com>.
--- Matt Bathje <mp...@ntsource.com> wrote:


> - Does that fact that the newly-compiled file is always called from a
> 
> <jsp:include page="xxx.jsp" /> make a difference?

try <%@ include file="xxx.jsp" %>





		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250

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