tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Johnson <>
Subject [TC6] default JSP factory not initialized early enough
Date Wed, 04 Oct 2006 21:48:36 GMT

With the latest TC6 code, I'm seeing a problem that did not exist on 
earlier TC6 drivers.  Sorry that I can't put a finger on when this problem 
arose.  I looked into relevant source files (like JspRuntimeContext) but 
haven't found the source of the problem.

Here's the issue (a testcase is attached below).

My app is very simple: it installs ServletContextListener for the purpose 
of adding a custom ELResolver.  It accomplishes this via:

    public void contextInitialized(ServletContextEvent evt) {
        ServletContext context = evt.getServletContext();
        JspApplicationContext jspContext = 
        jspContext.addELResolver(new ChipsELResolver());

The problem is that JspFactory.getDefaultFactory() is returning null 
(system.out in bold, below):

Oct 4, 2006 5:32:18 PM org.apache.catalina.core.AprLifecycleListener 
INFO: The Apache Tomcat Native library which allows optimal performance in 
ction environments was not found on the java.library.path: 
\Python22;C:\Program Files\PC-Doctor for 
Oct 4, 2006 5:32:18 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Oct 4, 2006 5:32:19 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1234 ms
Oct 4, 2006 5:32:19 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Oct 4, 2006 5:32:19 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.0-dev
Oct 4, 2006 5:32:19 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Oct 4, 2006 5:32:19 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive ELResolverTest.war
ChipsListener.contextInitialized  evt= 
ChipsListener.contextInitialized  context= 
ChipsListener.contextInitialized  JspFactory.getDefaultFactory()= null
Oct 4, 2006 5:32:20 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Oct 4, 2006 5:32:20 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ELResolverTest] startup failed due to previous errors
Oct 4, 2006 5:32:21 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 4, 2006 5:32:21 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /
Oct 4, 2006 5:32:21 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63  config=null
Oct 4, 2006 5:32:21 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2657 ms

This is easily reproducible if you deploy the ELResolverTest.war before 
the server has started (I'm assuming JspFactory.setDefaultFactory() hasn't 
been invoked at the time the listeners are being installed).  If you 
deploy the WAR *after* the server starts, the problem does not manifest 
and the app works --- until you stop and restart the server.

This zip file contains the WAR in the ELResolverTest\dist directory; and 
the source and build scripts are provided as well.



View raw message