Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-7775

Default jsf 2.0 resource lookup fails if resources are present in jar in WEB-INF/lib

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 6.0.0.M4
    • 6.0.0.M2
    • None
    • None
    • Compatibility/Configuration

    Description

      We have a JSF 2.0 composite component in WEBROOT/resources and at the same time a jar in WEB-INF/lib that has resources under the META-INF/resources directory. Then a nullpointer is thrown with the following stacktrace if the composite component is looked up for rendering in another xhtml page

      2010-02-28 19:21:32,839 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-localhost%2F127.0.0.1-8080-1) Error Rendering View[/homeLucene.xhtml]: java.lang.NullPointerException
      at org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirContext.java:714)
      at org.apache.catalina.core.ApplicationContext.listCollectionPaths(ApplicationContext.java:1397)
      at org.apache.catalina.core.ApplicationContext.getResourcePathsInternal(ApplicationContext.java:645)
      at org.apache.catalina.core.ApplicationContext.getResourcePaths(ApplicationContext.java:628)
      at org.apache.catalina.core.ApplicationContextFacade.getResourcePaths(ApplicationContextFacade.java:199)
      at com.sun.faces.context.ExternalContextImpl.getResourcePaths(ExternalContextImpl.java:480)
      at com.sun.faces.application.resource.WebappResourceHelper.findResource(WebappResourceHelper.java:191)
      at com.sun.faces.application.resource.ResourceManager.findResource(ResourceManager.java:384)
      at com.sun.faces.application.resource.ResourceManager.doLookup(ResourceManager.java:234)
      at com.sun.faces.application.resource.ResourceManager.findResource(ResourceManager.java:181)
      at com.sun.faces.application.resource.ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:140)
      at com.sun.faces.application.resource.ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:120)
      at com.sun.faces.renderkit.html_basic.StylesheetRenderer.encodeEnd(StylesheetRenderer.java:91)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1620)
      at org.primefaces.renderkit.HeadRenderer.encodeBegin(HeadRenderer.java:42)
      at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:823)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1611)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)

      The error is thrown in the listbindings-method of the ProxyDirContext at the line

      while (overlay.hasMore()) {
      Binding pair = overlay.next();
      ...
      }

      because overlay = null. This part of the code is reached in this case because the presence of the kind of jar mentioned in the beginning of this issue description implies that the overlays member field of the ProxyDirContext is not-null (and not empty). The composite component does, of course, not exist in the jar resulting in a null overlay.

      A simple check on overlay != null before executing the while loop seems sufficient to resolve the issue.

      Attachments

        Issue Links

          Activity

            People

              rmaucher Remy Maucherat
              krustie_jira Johan Kustermans (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: