title: ELResolver cannot handle a null base Object - Weblogic 10.3.x, Facelets 1.1.14, RichFaces 3.3.2
body: <p>I'm having trouble using RichFaces 3.3.2 and Facelets 1.1.14 under Weblogic 10.3.4 and 10.3.5 (aka 11g). I have an xhtml file with the expression <code>#{empty messages}</code>, and on the console I get the following exception:</p>
  
  <pre><code>SEVERE: Error Rendering View[/index.xhtml]
  javax.el.ELException: //media/DADOS/data/java/wl1034/user_projects/domains/wlrep1034/autodeploy/SimpleJSFa/index.xhtml:
  
    ELResolver cannot handle a null base Object with identifier 'messages'
  
      at com.sun.facelets.compiler.TextInstruction.write(TextInstruction.java:48)
      at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
      at com.sun.facelets.compiler.UILeaf.encodeAll(UILeaf.java:149)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
      at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
  </code></pre>
  
  <p>The <code>messages</code> variable really does not exist at this point, but that's why I used an <code>empty</code> statement. It works fine on Tomcat 5.5 and Websphere 6.1.</p>
  
  <p>The complete xhtml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:rich="http://richfaces.org/rich"&gt;
  
  &lt;body&gt;
  
      &lt;h1&gt;Bean Message: #{TestBean.greeting}&lt;/h1&gt;
  
      Are there messages pending? #{messages == null || empty messages} .
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>TestBean.java:</p>
  
  <pre><code>package eg.bean;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.faces.context.FacesContext;
  import javax.servlet.http.HttpServletRequest;
  
  public class TestBean {
  
      private String greeting = "Hello, World!";
  
      public TestBean() {
          // Uncommenting the following line puts an object in the session, under the
          // key "messages", and then the page displays properly.
          // addSomeMessages();
      }
  
      public String getGreeting() {
          return greeting;
      }
  
      public void setGreeting( String message ) {
          this.greeting = message;
      }
  
      public void addSomeMessages() {
          // This method is not being called for this example, but this is where
          // I would add a list of messages to be displayed to the user, and place it
          // on session scope (not advisable, I know, but bear with me)
          HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
          List&lt;String&gt; messages = new ArrayList&lt;String&gt;();
          messages.add( "A message.");
          request.getSession().setAttribute( "messages", messages );
      }
  
  }
  </code></pre>
  
  <p>I can only guess that somehow a different implementation of ELResolver is being used by Weblogic, which could be caused by classloader conflicts, but I've been fiddling with it for a while and am getting nowhere.</p>
  
  <p>I have the following jars in WEB-INF/lib:</p>
  
  <pre><code>commons-beanutils-1.7.0.jar
  commons-digester-1.8.jar
  commons-logging-1.1.1.jar
  jsf-api.jar
  jsf-facelets.jar
  jsf-impl.jar
  richfaces-api-3.3.2.SR1.jar
  richfaces-impl-3.3.2.SR1.jar
  richfaces-ui-3.3.2.SR1.jar
  SimpleJSF.jar
  </code></pre>
  
  <p>My faces-config.xml looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xi="http://www.w3.org/2001/XInclude"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"&gt;
  
   &lt;managed-bean&gt;
    &lt;managed-bean-name&gt;TestBean&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;eg.bean.TestBean&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;request&lt;/managed-bean-scope&gt;
   &lt;/managed-bean&gt;
  
   &lt;application&gt;
    &lt;view-handler&gt;com.sun.facelets.FaceletViewHandler&lt;/view-handler&gt;
    &lt;resource-bundle&gt;
     &lt;base-name&gt;RepositoryBundle&lt;/base-name&gt;
     &lt;var&gt;bundle&lt;/var&gt;
    &lt;/resource-bundle&gt;
   &lt;/application&gt;
  &lt;/faces-config&gt;
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app id="WebApp_ID" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"&gt;
  
      &lt;!-- Use Documents Saved as *.xhtml --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.DEFAULT_SUFFIX&lt;/param-name&gt;
          &lt;param-value&gt;.xhtml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
          &lt;param-value&gt;server&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
        &lt;param-name&gt;com.sun.faces.disableVersionTracking&lt;/param-name&gt;
        &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;facelets.DEVELOPMENT&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;facelets.LIBRARIES&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/sense.taglib.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;com.sun.faces.validateXml&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;org.ajax4jsf.VIEW_HANDLERS&lt;/param-name&gt;
          &lt;param-value&gt;com.sensedia.repository.web.startup.SensediaFaceletViewHandler&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;com.prime.facestrace.DISABLE_TRACE&lt;/param-name&gt;
          &lt;param-value&gt;false&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;!-- ********************** SERVLETS ********************** --&gt;
  
      &lt;!-- Faces Servlet --&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;!-- ********************** FILTERS ********************** --&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;richfaces&lt;/filter-name&gt;
          &lt;filter-class&gt;org.ajax4jsf.Filter&lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;richfaces&lt;/filter-name&gt;
          &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
          &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
          &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
          &lt;dispatcher&gt;INCLUDE&lt;/dispatcher&gt;
      &lt;/filter-mapping&gt;
  
      &lt;!-- Faces Servlet Mapping --&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.jsf&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>EDIT: I was deploying as a standalone war file, but I also tried packaging as an EAR module. Problem persists. When deploying as an EAR file I added a <code>weblogic.xml</code> jar besides my own <code>web.xml</code> with the following content:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;container-descriptor&gt;
          &lt;prefer-web-inf-classes&gt;true&lt;/prefer-web-inf-classes&gt;
      &lt;/container-descriptor&gt;
  &lt;/weblogic-web-app&gt;
  </code></pre>
  
  <p>I also added an <code>application.xml</code> to the ear's <code>META-INF</code> directory, simply referencing the war module. I also added a <code>weblogic-application.xml</code> file besides that one, to further specify classloader isolation:</p>
  
  <pre><code>&lt;weblogic-application xmlns="http://www.bea.com/ns/weblogic/90"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  
      &lt;application-param&gt;
          &lt;param-name&gt;webapp.encoding.default&lt;/param-name&gt;
          &lt;param-value&gt;UTF-8&lt;/param-value&gt;
      &lt;/application-param&gt;
  
      &lt;prefer-application-packages&gt;
          &lt;package-name&gt;org.mozilla.*&lt;/package-name&gt;
          &lt;package-name&gt;javax.jws.*&lt;/package-name&gt;
          &lt;package-name&gt;com.sun.*&lt;/package-name&gt;
          &lt;package-name&gt;javax.xml.rpc.*&lt;/package-name&gt;
          &lt;package-name&gt;javax.xml.soap.*&lt;/package-name&gt;
      &lt;/prefer-application-packages&gt;
  
  &lt;/weblogic-application&gt;
  </code></pre>