Bug 31257 - java.endorsed.dirs is not used when JSP compilation is forked
Summary: java.endorsed.dirs is not used when JSP compilation is forked
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 5.0.27
Hardware: All Windows XP
: P3 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2004-09-16 05:10 UTC by James DeFelice
Modified: 2008-07-30 11:14 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description James DeFelice 2004-09-16 05:10:06 UTC
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 
--- src\org\apache\jasper\compiler\Compiler.java        Thu Sep 16 00:05:14 

*** 349,358 ****
--- 349,369 ----
              info.append("    extension dir=" + exts + "\n");

+         // Add endorsed directories
+         String endorsed = System.getProperty("java.endorsed.dirs");
+         if(endorsed != null) {
+             Javac.ImplementationSpecificArgument endorsedArg = 
+             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

true, i should probably check ctxt.getOptions().getFork() in the if() as well, 
but since i always fork it doesn't matter to me.
Comment 1 Yoav Shapira 2004-09-21 19:47:18 UTC
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.
Comment 2 Goldyard 2007-11-24 10:08:21 UTC
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.
Comment 3 Mark Thomas 2008-04-20 15:39:22 UTC
The quoting issue has been fixed in trunk and proposed for 5.5.x and 6.0.x
Comment 4 Mark Thomas 2008-05-01 10:49:04 UTC
This has been committed to 6.0.x and will be in 6.0.17 onwards.
Comment 5 Mark Thomas 2008-07-30 11:14:40 UTC
This has been fixed in 5.5.x and will be included in 5.5.27 onwards.