Bug 19725 - jsp compiler fails on windows if context docbase is too long
Summary: jsp compiler fails on windows if context docbase is too long
Status: RESOLVED WONTFIX
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 4.1.24
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-07 12:58 UTC by Pablo Casado
Modified: 2005-03-20 17:06 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pablo Casado 2003-05-07 12:58:15 UTC
On a windows OS, a long path in a docbase for a context configured in 
server.xml results in the following error when trying to compile a jsp file:

ERROR: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
    [javac] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
    [javac] javac: invalid flag: C:\Documents
    [javac] Usage: javac  
    [javac] where possible options include:
    [javac]   -g                        Generate all debugging info
    [javac]   -g:none                   Generate no debugging info
    [javac]   -g:{lines,vars,source}    Generate only some debugging info
    [javac]   -nowarn                   Generate no warnings
    [javac]   -verbose                  Output messages about what the compiler 
is doing
    [javac]   -deprecation              Output source locations where 
deprecated APIs are used
    [javac]   -classpath          Specify where to find user class files
    [javac]   -sourcepath         Specify where to find input source files
    [javac]   -bootclasspath      Override location of bootstrap class files
    [javac]   -extdirs            Override location of installed extensions
    [javac]   -d             Specify where to place generated class files
    [javac]   -encoding       Specify character encoding used by source files
    [javac]   -source          Provide source compatibility with specified 
release
    [javac]   -target          Generate class files for specific VM version
    [javac]   -help                     Print a synopsis of standard options



Here is my config that causes the error:

<Context path="/vendir" docBase="C:\Documents and Settings\Pablo Casado\My 
Documents\Projects\vendir\head\build-home" workDir="C:\Documents and 
Settings\Pablo Casado\My Documents\Projects\vendir\head\work\org\apache\jsp" />

Here is one that works for the same app:

<Context path="/vendir" docBase="C:\Documents and Settings\vendir" 
workDir="C:\Documents and Settings\work" />

So my guess is that large path length for the docBase/workDir is the cause for 
the error. The problem does not occur on my suse linux box with a similarly 
long path name.

Note that this error does not occur in Tomcat version 4.0.x, so it was 
introduced in 4.1.x
Comment 1 Remy Maucherat 2003-05-07 13:31:00 UTC
I assume it happens when the command line sent to the compiler gets too long.
You could try switching to the in process compiler mode (see the fork init-param
of Jasper). In any case, it a limitation introduced by either Ant (which is used
as the Java compiler), the OS, or javac, so it cannot be fixed by Tomcat.
Comment 2 Joe Boon 2003-06-03 14:39:34 UTC
I can confirm that this is a problem with long paths. I have experienced this 
and have tracked it down to a problem in Ant. It is triggered by (a) a long 
javac command line, usually caused by long paths to a lib directory with lots 
of jars in it, combined with (b) spaces in the path to the Tomcat directory 
(more specifically to the work directory within the Tomcat directory).

The problem is documented in Ant bug 10499.
Comment 3 Antoine Levy-Lambert 2003-06-04 06:31:46 UTC
As Joe Boon said, this might in fact be caused by the bug 10499 in ant.
the next ant nightly build (http://cvs.apache.org/builds/ant/nightly/2003-06-04) 
contains a fix for the bug 10499
see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10499 
This might solve this issue too.
Individual users might want to patch their ant.jar or replace it with the one of 
the nightly build if they are affected by this problem.