Mantis - Resin
Viewing Issue Advanced Details
97 minor always 04-12-05 00:00 01-11-08 16:00
3.0.12 fixed  
none 3.1.5  
0000097: Ant task for JspCompiler
(rep by D Becker)

After a number of google searches, I have been unable to figure out how to
nicely precompile JSP pages for Resin via Ant. I've found the JspCompiler
class, but that seems to be geared for one-off compiling. There's got to be
a better way.

04-12-05 00:00   
With resin 2 our company used the -compile option of httpd.exe to compile a single JSP page and then built a little script to discover all of the JSP pages to be compiled using the 'find' command. However, resin 3 does not support the -compile flag.

I'm trying to build JSP compilation into our ant build but running up against a roadblock using JspCompiler. I have successfully compiled the JSP pages for our app which do not use taglibs, but any page with a taglib always fails with the following error:

Exception in thread "main" com.caucho.jsp.JspLineParseException: /searchTableView.jsp:18: Can't find taglib-location `/s
truts-bean'. The taglib-location must match a tag library either:
1) by pointing to a .tld directly, relative to the application's root directory
2) specified in the web.xml
3) defined in a jar's .tld in META-INF
4) defined in a .tld in WEB-INF
5) predefined by Resin
        at com.caucho.jsp.JspParser.error(
        at com.caucho.jsp.JspParser.processTaglib(
        at com.caucho.jsp.JspParser.processTaglibDirective(
        at com.caucho.jsp.JspParser.parseDirective(
        at com.caucho.jsp.JspParser.parseScriptlet(
        at com.caucho.jsp.JspParser.parseNode(
        at com.caucho.jsp.JspParser.parseJsp(
        at com.caucho.jsp.JspParser.parse(
        at com.caucho.jsp.JspCompilerInstance.generate(
        at com.caucho.jsp.JspCompiler.compileJsp(
        at com.caucho.jsp.JspCompiler.main(

I'm not sure what's going on because WEB-INF/web.xml contains this:


And the JSP contains this:

  <%@ taglib uri="/struts-bean" prefix="bean" %>

This page compiles fine when actually running under resin, but not when using the JspCompiler from the command line like so:

java -cp /usr/local/resin/lib/resin.jar:/usr/local/resin/lib/jsdk-24.jar:/usr/local/resin/lib/isorelax.
/nprise.jar:./web/WEB-INF/classes com.caucho.jsp.JspCompiler -conf ./compile-app.xml web/searchTableView.jsp

and my compile-app.xml looks like this:

<web-app xmlns=""> [^]
  <java compiler="javac" args="-source 1.4 -g"/>

The lack of JSP compilation as part of our build process is a major reduction in functionality from resin 2.x. An ant task would be quite nice, but at this point even getting command line JspCompiler to work would be enough.

04-12-05 00:00   
Precompilation with and works fine for me; I just send the application root as parameter to the JspCompiler. Also remember to use fork.

  <target name="jspcompile">
    <java classname="com.caucho.jsp.JspCompiler" fork="true" >
      <arg line="-app-dir ${webapp.root}" />
01-11-08 16:00   
See [^] for documentation