title: GAE/J: unable to register a custom ELResolver
body: <p>I need to register a custom <code>ELResolver</code> for a Google App Engine project. </p>
  
  <p>Since it must be registered before any request is received, <a href="http://java.sun.com/javaee/5/docs/api/javax/servlet/jsp/JspApplicationContext.html#addELResolver(javax.el.ELResolver)" rel="nofollow noreferrer">as specified by the Javadoc</a>: </p>
  
  <blockquote>
    <p>It is illegal to register an ELResolver after the application has 
    received any request from the client. If an attempt is made to register 
    an ELResolver after that time, an IllegalStateException is thrown. </p>
  </blockquote>
  
  <p>I'm using a ServletContextListener:</p>
  
  <pre><code>public class RegisterCustomELResolver implements ServletContextListener { 
  
      @Override 
      public void contextInitialized(ServletContextEvent sce) { 
          ServletContext context = sce.getServletContext(); 
          JspApplicationContext jspContext = 
              JspFactory.getDefaultFactory().getJspApplicationContext(context); 
          jspContext.addELResolver(new MyELResolver()); 
      } 
  
      ... 
  }
  </code></pre>
  
  <p>The problem is that <code>JspFactory.getDefaultFactory()</code> returns always null. I've alreay filled a bug report. Any idea for a workaround?</p>