Project: Tomcat
Bug 31257 java.endorsed.dirs is not used when JSP compilation is forked
Reported: 2004-09-16 05:10:06 | Status: resolved fixed

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.

Files changed in fix:
java/org/apache/jasper/compiler/AntCompiler.java