2 Replies Latest reply on Apr 27, 2010 8:03 AM by Matthias Paul Scholz

    AS 6 Nullpointer exception when accessing JSF 2 resource map using "resource[]"

    Matthias Paul Scholz Novice

      When I access the resource map in a JSF 2 page on JBoss 6.0.0.M2 by using the "resource[]" notation in an EL expression like this:

       

      <h:head>       

           <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />       

           <link rel="stylesheet" href="#{resource['css:mystyle.css']}" type="text/css" media="screen, projection"/>

           <title>Whatever</title>

      </h:head>

       

      the server throws a NullPointerException (stack trace see below).

       

      When replacing the expression in question with a simple

      href="../resources/css/mystyle.css"

      , the page renders fine.

       

      As the code above works without problems on Glassfish v3, I wonder what am I doing wrong here when it comes to JBoss?

       

      ------ snip stack trace -----

       

      java.lang.NullPointerException
           org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirContext.java:714)
           com.sun.faces.context.ExternalContextImpl.getResourcePaths(ExternalContextImpl.java:480)
           com.sun.faces.application.resource.WebappResourceHelper.findLibrary(WebappResourceHelper.java:141)
           com.sun.faces.application.resource.ResourceManager.findLibrary(ResourceManager.java:337)
           com.sun.faces.application.resource.ResourceManager.doLookup(ResourceManager.java:222)
           com.sun.faces.application.resource.ResourceManager.findResource(ResourceManager.java:181)
           com.sun.faces.application.resource.ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:140)
           com.sun.faces.application.resource.ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:120)
           com.sun.faces.el.ResourceELResolver.getValue(ResourceELResolver.java:130)
           javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
           com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
           org.apache.el.parser.AstValue.getValue(AstValue.java:134)
           org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:187)
           com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:207)
           com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:82)
           com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:75)
           com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:176)
           javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
           javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
           com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
           com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
           com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
           com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
           com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
           javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
      

       

      ---- snip end of stack trace ----