Bug 41182

Summary: Jasper ignores JspServlet's 'classpath' init param
Product: Tomcat 5 Reporter: Werner Loibl <werner.loibl>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 5.5.20   
Target Milestone: ---   
Hardware: Other   
OS: All   

Description Werner Loibl 2006-12-15 07:07:24 UTC
JspServlet describes and reads a servlet init parameter 'classpath'.
Documentation says: 

"classpath - What class path should I use while compiling generated servlets? By
default the classpath is created dynamically based on the current web application."

Current behaviour is that the configured classpath is only considered if no
classpath is configured as servlet context attribute. 

---JspRuntimeContext:335----
String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH);
if (cp == null || cp.equals("")) {
  cp = options.getClassPath();
}

It seems that when running within tomcat the context attribute is usually
present and therefore the classpath from the servlet init parameter is not
considered.
Comment 1 Werner Loibl 2006-12-18 02:45:06 UTC
I should add that I put the mapping in the web.xml deployment descriptor of my
webapp, not as part of [tomcatroot]/conf/web.xml. 
Comment 2 Mark Thomas 2006-12-18 17:28:44 UTC
This parameter will never be used when Jasper is used within Tomcat. I have
updated the docs accordingly. The updated docs will be in 5.5.21 onwards.

The reason for this behaviour is that classes required for compilation will
almost certainly be required at runtime so they need to be visible to the web
application's class loader rather than added via this parameter.