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
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.
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.
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.