You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Wareham <ch...@pa.press.net> on 2005/12/06 13:12:48 UTC
Compiling JSPs - how to ignore files with certain extensions.
I have a web app structured as follows:
myapp/footer.jspf
myapp/header.jspf
myapp/index.jsp
myapp/taglibs.jspf
myapp/WEB-INF/...
I would like to add a target to my Ant build.xml to precompile the JSPs,
so that I can check they do not reference any unknown custom tags.
However, JspC appears to be trying to compile the files ending in
".jspf" as well as ".jsp". This is causing the compile to fail, as the
jspf files are fragments that are included into index.jsp:
<%@ include file="taglibs.jspf" %>
do some stuff that might result in redirects ...
<%@ include file="header.jspf" %>
body of the page ...
<%@ include file="footer.jspf" %>
The taglibs fragment contains the taglib definitions common to all my
pages, while the header and footer contain "boilerplate" HTML common to
all my pages.
Is there anyway to prevent JspC from attempting to compile the fragment
files? I can see in the JspC JavaDocs that you can list and add
extensions that will get compiled, but not remove them.
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Compiling JSPs - how to ignore files with certain extensions.
Posted by Chris Wareham <ch...@pa.press.net>.
Tim Funk wrote:
> For the OOM error - you might want to add
> compile="false" to your jsp2 task so compilation is not done. (.tag
> files still end up being compiled but thats a different issue) Then for
> your javac task add (increase as appropriate)
> fork='true'
> memoryInitialSize='192m'
> memoryMaximumSize='356m'
>
>
Many thanks. Your suggestions (and a bit of fiddling with ulimit) fixed
the out of memory error.
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Compiling JSPs - how to ignore files with certain extensions.
Posted by Tim Funk <fu...@joedog.org>.
For the OOM error - you might want to add
compile="false" to your jsp2 task so compilation is not done. (.tag files
still end up being compiled but thats a different issue) Then for your javac
task add (increase as appropriate)
fork='true'
memoryInitialSize='192m'
memoryMaximumSize='356m'
-Tim
Chris Wareham wrote:
> Tim Funk wrote:
>
>> I suspect that you have a file which includes header.jspf - and that
>> parent file is not including the fn tag lib. (The (potentially) bad
>> error message is another issue)
>>
>> -Tim
>>
>
> Yes, there was one file with a .jsp extension that didn't include
> taglibs.jspf before header.jspf. Now the JspC task causes the JVM to run
> out of memory (java.lang.OutOfMemoryError), but it's not complaining
> about header.jspf anymore!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Compiling JSPs - how to ignore files with certain extensions.
Posted by Chris Wareham <ch...@pa.press.net>.
Tim Funk wrote:
> I suspect that you have a file which includes header.jspf - and that
> parent file is not including the fn tag lib. (The (potentially) bad
> error message is another issue)
>
> -Tim
>
Yes, there was one file with a .jsp extension that didn't include
taglibs.jspf before header.jspf. Now the JspC task causes the JVM to run
out of memory (java.lang.OutOfMemoryError), but it's not complaining
about header.jspf anymore!
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Compiling JSPs - how to ignore files with certain extensions.
Posted by Tim Funk <fu...@joedog.org>.
I suspect that you have a file which includes header.jspf - and that parent
file is not including the fn tag lib. (The (potentially) bad error message is
another issue)
-Tim
Chris Wareham wrote:
> Tim Funk wrote:
>
>> What tomcat version and commands are you using? IIRC - jspf files by
>> default are not precompiled.
>>
>
> I started with Tomcat 5.0.30, but have switched to 5.5.12. The ant
> targets that I am using is similar to the ones in the Tomcat docs:
>
> <target name="init-jsp" depends="build">
> <mkdir dir="build-jsp"/>
> <mkdir dir="src-jsp"/>
> </target>
>
> <target name="build-jsp" depends="init-jsp">
> <taskdef classname="org.apache.jasper.JspC" name="jsp2">
> <classpath>
> <fileset dir="${env.CATALINA_HOME}/common/lib">
> <include name="*.jar"/>
> </fileset>
> <fileset dir="lib">
> <include name="*.jar"/>
> </fileset>
> <path location="classes"/>
> </classpath>
> </taskdef>
>
> <jsp2 uriroot="../../myapp" outputDir="src-jsp"/>
>
> <javac srcdir="src-jsp" destdir="build-jsp" deprecation="true">
> <classpath>
> <classpath>
> <fileset dir="${env.CATALINA_HOME}/common/lib">
> <include name="*.jar"/>
> </fileset>
> <fileset dir="lib">
> <include name="*.jar"/>
> </fileset>
> <path location="classes"/>
> </classpath>
> </javac>
> </target>
>
> <target name="clean-jsp">
> <delete dir="src-jsp"/>
> <delete dir="build-jsp"/>
> </target>
>
> The "build" target that "init-jsp" depends on builds my Java code and
> places it into myapp/WEB-INF/classes.
>
> When I run "ant build-jsp" it fails on the <jsp2> line with the
> following:
>
> BUILD FAILED
> /home/chris/myapp/WEB-INF/build.xml:470:
> org.apache.jasper.JasperException:
> file:/home/chris/myapp/header.jspf(49,74) The attribute prefix fn does
> not correspond to any imported tag library
>
> However, in taglibs.jspf, the functions JSTL is included and the jar
> file is in myapp/WEB-INF/lib. This is why I suspect that JspC is
> trying to compile header.jspf.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Compiling JSPs - how to ignore files with certain extensions.
Posted by Chris Wareham <ch...@pa.press.net>.
Tim Funk wrote:
> What tomcat version and commands are you using? IIRC - jspf files by
> default are not precompiled.
>
I started with Tomcat 5.0.30, but have switched to 5.5.12. The ant
targets that I am using is similar to the ones in the Tomcat docs:
<target name="init-jsp" depends="build">
<mkdir dir="build-jsp"/>
<mkdir dir="src-jsp"/>
</target>
<target name="build-jsp" depends="init-jsp">
<taskdef classname="org.apache.jasper.JspC" name="jsp2">
<classpath>
<fileset dir="${env.CATALINA_HOME}/common/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<path location="classes"/>
</classpath>
</taskdef>
<jsp2 uriroot="../../myapp" outputDir="src-jsp"/>
<javac srcdir="src-jsp" destdir="build-jsp" deprecation="true">
<classpath>
<classpath>
<fileset dir="${env.CATALINA_HOME}/common/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<path location="classes"/>
</classpath>
</javac>
</target>
<target name="clean-jsp">
<delete dir="src-jsp"/>
<delete dir="build-jsp"/>
</target>
The "build" target that "init-jsp" depends on builds my Java code and
places it into myapp/WEB-INF/classes.
When I run "ant build-jsp" it fails on the <jsp2> line with the
following:
BUILD FAILED
/home/chris/myapp/WEB-INF/build.xml:470:
org.apache.jasper.JasperException:
file:/home/chris/myapp/header.jspf(49,74) The attribute prefix fn does
not correspond to any imported tag library
However, in taglibs.jspf, the functions JSTL is included and the jar
file is in myapp/WEB-INF/lib. This is why I suspect that JspC is
trying to compile header.jspf.
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Compiling JSPs - how to ignore files with certain extensions.
Posted by Tim Funk <fu...@joedog.org>.
What tomcat version and commands are you using? IIRC - jspf files by default
are not precompiled.
-Tim
Chris Wareham wrote:
> I have a web app structured as follows:
>
> myapp/footer.jspf
> myapp/header.jspf
> myapp/index.jsp
> myapp/taglibs.jspf
> myapp/WEB-INF/...
>
> I would like to add a target to my Ant build.xml to precompile the JSPs,
> so that I can check they do not reference any unknown custom tags.
> However, JspC appears to be trying to compile the files ending in
> ".jspf" as well as ".jsp". This is causing the compile to fail, as the
> jspf files are fragments that are included into index.jsp:
>
> <%@ include file="taglibs.jspf" %>
>
> do some stuff that might result in redirects ...
>
> <%@ include file="header.jspf" %>
>
> body of the page ...
>
> <%@ include file="footer.jspf" %>
>
> The taglibs fragment contains the taglib definitions common to all my
> pages, while the header and footer contain "boilerplate" HTML common to
> all my pages.
>
> Is there anyway to prevent JspC from attempting to compile the fragment
> files? I can see in the JspC JavaDocs that you can list and add
> extensions that will get compiled, but not remove them.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org