When the JSP compiler forks a javac process, it should check to see what the currently endorsed directories are (check the system property "java.endorsed.dirs" - otherwise, classes end up missing and JSP pages do not properly compile. We experienced a problem when we explicitly set the java.endorsed.dirs property on the command line, and the JSP compiler did not use it when javac was forked. I have patched org.apache.jasper.compiler.Compiler to support this: *** src.original\jakarta-tomcat-jasper\jasper2 \src\share\org\apache\jasper\compiler\Compiler.java Tue Jun 15 17:30:35 2004 --- src\org\apache\jasper\compiler\Compiler.java Thu Sep 16 00:05:14 2004 *************** *** 349,358 **** --- 349,369 ---- extdirs.setPath(exts); javac.setExtdirs(extdirs); info.append(" extension dir=" + exts + "\n"); } + // Add endorsed directories + String endorsed = System.getProperty("java.endorsed.dirs"); + if(endorsed != null) { + Javac.ImplementationSpecificArgument endorsedArg = javac.createCompilerArg(); + endorsedArg.setLine("-J-Djava.endorsed.dirs="+endorsed); + info.append(" endorsed dir=" + endorsed + "\n"); + } + else { + info.append(" no endorsed dirs specified\n"); + } + // Configure the compiler object javac.setEncoding(javaEncoding); javac.setClasspath(path); javac.setDebug(ctxt.getOptions().getClassDebugInfo()); true, i should probably check ctxt.getOptions().getFork() in the if() as well, but since i always fork it doesn't matter to me.
Thanks for submitting this enhancement. I've applied it to both the Tomcat 5.0 and 5.5 branches: it will be in 5.0.29 and 5.5.3. However, this applies to the Ant/Javac compiler only, not to the JDT compiler, which is the default in 5.5.3. If you have an equivalent patch for the JDT compiler, please submit it. Otherwise, I'll do some research to try to find the equivalent JDT compiler option, but if you submit a patch it'll get done faster.
There is still a bug in this fixing. When the endorsed dir is like: C:\Program Files\Java\jdk1.5.0_11\jre\lib\endorsed the space char in dir will cause a compile error. "Files\Java\jdk1.5.0_11 \jre\lib\endorsed" part will be treated as a new parameter of javac. Please use quotation marks to quotate each dir in the endorsed dir list.
The quoting issue has been fixed in trunk and proposed for 5.5.x and 6.0.x
This has been committed to 6.0.x and will be in 6.0.17 onwards.
This has been fixed in 5.5.x and will be included in 5.5.27 onwards.