I’m learning ANT and I’m trying to deploy a web application in tomcat 6.0.20 server.
I build the test application and I deploy it with the manager ant tasks and everything goes right. I load a HTML page and it works… When I try to view a JSP tomcat give me a JasperException, coused by a NullPointerException in the auto-generated Servlet. The JSP is almost an HTML file with jsp extension. The Exception is throwed in the _jspInit method when it tries to run the following:
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
somebody can help me? thanks!
I’m learning ANT and I’m trying to deploy a web application in tomcat 6.0.20
Share
Probably you have
jsp-api-*.jarin/WEB-INF/lib. Remove it.EDIT: Explanation
JSP API contains an abstract class
JspFactory. It has astaticfield to store a server-specificJspFactoryimplementation. So, Tomcat sets a value of this field and JSP page initialization code reads it to obtain aJspFactoryimplementation. In your case you have two differentJspFactoryclasses – one loaded by server classloader from server jars and another loaded by application classloader from/WEB-INF/lib. Because classes loaded by different classloaders are different classes, they have differentstaticfield values, thereforeJspFactoryobtained by the JSP code (_jspxFactory) isnull.This illustrates one of the possible problems caused by use of
staticfields.