DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29182>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29182

Jasper locks jar files when compiling JSPs through Ant





------- Additional Comments From [EMAIL PROTECTED]  2004-05-25 08:54 -------
I don't think this is a Javac or Ant issue - in fact, my testcase does not use
Javac at all. As I wrote privately to Kin-Man, I believe the problem is that
JspC uses URLClassLoader, which is known to lock jar files. When Jasper runs
inside the Catalina container, Catalina's WebappClassLoader is used, so the code
that locks jars is avoided.

But thanks for the hint with fork=true, this actually helped. I replaced the
<taskdef name="jasper2" classname="org.apache.jasper.JspC"> style of calling
Jasper by the <java> task, which allows to fork JspC:

<java classname="org.apache.jasper.JspC"
    fork="true"
    failonerror="true"
>
    <arg value="-uriroot"/>
    <arg value="${basedir}/build/web"/>
    <arg value="-d"/>
    <arg value="${basedir}/build/jsps/src"/>
    <arg value="-die1"/>
    <classpath> 
        <pathelement location="${java.home}/../lib/tools.jar"/> 
        <fileset dir="${tomcat.home}/bin"> 
            <include name="*.jar"/> 
        </fileset> 
        <fileset dir="${tomcat.home}/server/lib"> 
            <include name="*.jar"/> 
        </fileset> 
        <fileset dir="${tomcat.home}/common/lib"> 
            <include name="*.jar"/> 
        </fileset> 
    </classpath> 
</java>

When using the above code, jar files are not locked and my testcase succeeds.
However, I don't much like this solution, because:

- Code that uses <java> is uglier than when you use <taskdef>
- Tomcat documentation recommends the use of <taskdef>, see:
  http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jasper-howto.html

So I would still appreciate if this is fixed.

There is an additional aspect: many current IDEs have some kind of Ant
integrations, and most IDEs run Ant internally, without launching a separate
process. So when JspC locks jar files, these jar files will be locked until the
IDE exits. That's another compelling reason to fix this issue. Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to