Mantis - Resin
Viewing Issue Advanced Details
3578 major always 06-25-09 19:38 07-15-09 14:17
rmann  
ferg  
normal  
closed 4.0.0  
fixed  
none    
none 4.0.1  
0003578: JSP 2.0-style tag definitions cause calling page to recompile every access
I've got a fairly straightforward page that includes these lines:

<%@ taglib prefix="lz" tagdir="/WEB-INF/tags/lz"
%>
.
.
.
<head>
   <title>My Page</title>
   <lz:base/>
.
.
.
</head>
.
.
.

In resin 4.0.0, the presence of the <lz:base/> tag triggers some work on Resin's part that results in recompiling both the tag and the page. The tag is defined by a .tag file in WEB-INF/tags/lz:

<%@tag body-content="empty"
%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" [^]
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" [^]
%><%
   if (("http".equals(request.getScheme()) && request.getLocalPort() != 80)
       || ("https".equals(request.getScheme()) && request.getLocalPort() != 443))
   {
       request.setAttribute("port", ":" + request.getLocalPort());
   }
%><base href="${pageContext.request.scheme}://${pageContext.request.serverName}${port}${pageContext.request.contextPath}/"/>


Here is what I see in the logs (set to FINE for most everything): the request comes in, resin decides that the class created for the base tag is missing, recompiles it, and then detects that the class digest is modified (notably, the new digest is -1, whereas the old is -4088317106370417708). So then it compiles the page's JSP again.

Timing for the request on the browser shows it takes about 300 ms (repeated reloads) to get it when I include the tag, and about 40 ms when I don't.

If I include the code for the tag directly in my JSP, I see no recompilation, and similarly rapid page loads. Referencing JSTL tags like fmt: does not seem to cause this difficulty.

I also see a "_jsp._index__jsp destroy" message in the logs before it gets the ClassNotFoundException. I don't know what that means.

Here are the logs:

[06-24 18:47:18.919] {http--80-9} FINE (com.caucho.server.port.TcpConnection) TcpConnection[id=9,] starting connection TcpConnection[id=http--80-9,http://*:80,ACCEPT], [^] total=5
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] GET / HTTP/1.1
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] Remote-IP: 12.155.29.1:56273
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] Host: satdb.org
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] Cache-Control: max-age=0
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] Accept-Language: en-us
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] Accept-Encoding: gzip, deflate
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] Cookie: JSESSIONID=aaaRgt_gP5iYl6bUVcvis
[06-24 18:47:18.920] {http--80-9} FINE (com.caucho.server.http.HttpRequest) Http[9] Connection: keep-alive
[06-24 18:47:18.931] {http--80-9} FINE (com.caucho.jsp.Page) _jsp._index__jsp destroy
[06-24 18:47:18.931] {http--80-9} FINE (com.caucho.jsp.PageManager) Jsp[] uri:/index.jsp(cp:,app:/export/home/satdb/www/org/satdb/www) -> /export/home/satdb/www/org/satdb/www/index.jsp
[06-24 18:47:18.936] {http--80-9} FINE (com.caucho.make.ClassDependency) java.lang.ClassNotFoundException: _jsp._WEB_22dINF._tags._lz._base__tag in EnvironmentClassLoader[web-app:http://default] [^]
[06-24 18:47:18.936] {http--80-9} at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1313)
[06-24 18:47:18.936] {http--80-9} at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1291)
[06-24 18:47:18.936] {http--80-9} at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
[06-24 18:47:18.936] {http--80-9} at java.lang.Class.forName0(Native Method)
[06-24 18:47:18.936] {http--80-9} at java.lang.Class.forName(Class.java:247)
[06-24 18:47:18.936] {http--80-9} at com.caucho.make.ClassDependency.<init>(ClassDependency.java:84)
[06-24 18:47:18.936] {http--80-9} at _jsp._index__jsp.init(_index__jsp.java:143)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.JspManager.preload(JspManager.java:320)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.JspManager.compile(JspManager.java:218)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.JspManager.createPage(JspManager.java:171)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.JspManager.createPage(JspManager.java:150)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.PageManager.getPage(PageManager.java:307)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.PageManager.getPage(PageManager.java:237)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.PageManager.getPage(PageManager.java:220)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.QServlet.getSubPage(QServlet.java:295)
[06-24 18:47:18.936] {http--80-9} at com.caucho.jsp.QServlet.getPage(QServlet.java:210)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.dispatch.PageFilterChain.compilePage(PageFilterChain.java:238)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:145)
[06-24 18:47:18.936] {http--80-9} at com.latencyzero.satdb.RequestFilter.doFilter(RequestFilter.java:114)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
[06-24 18:47:18.936] {http--80-9} at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
[06-24 18:47:18.936] {http--80-9} at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:185)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:264)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:275)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.port.TcpConnection.handleRequests(TcpConnection.java:644)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.port.TcpConnection$AcceptTask.doAccept(TcpConnection.java:1311)
[06-24 18:47:18.936] {http--80-9} at com.caucho.server.port.TcpConnection$AcceptTask.run(TcpConnection.java:1252)
[06-24 18:47:18.936] {http--80-9} at com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:866)
[06-24 18:47:18.936] {http--80-9} at com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:779)
[06-24 18:47:18.936] {http--80-9}
[06-24 18:47:18.936] {http--80-9} FINE (com.caucho.make.ClassDependency) _jsp._WEB_22dINF._tags._lz._base__tag class digest is modified (old=-4088317106370417708,new=-1)
[06-24 18:47:18.974] {http--80-9} CONFIG (com.caucho.java.JavaCompiler) Compiling _jsp/_index__jsp.java
[06-24 18:47:18.975] {Thread-59} FINE (com.caucho.loader.JarListLoader) tools.jar does not exist (path=/usr/local/java/versions/jdk1.6.0_12/jre/lib/tools.jar)
[06-24 18:47:19.138] {Thread-59} FINE (com.caucho.java.InternalCompiler)
[06-24 18:47:19.142] {http--80-9} FINE (com.caucho.java.JavaCompiler) merging .smap for _index__jsp.class
I found a partial solution: I added this line to app-default.xml:

   <compiling-loader path="WEB-INF/work"/>

It seems to me resin ought to implicitly add the work-dir, wherever it happens to be, but now the class loader can find the classes.

However, this also causes resin to reload the context every time I change a JSP.

Notes
(0004094)
ferg   
07-15-09 14:17   
jsp/10i0