title: JSF2: NullpointerException at custom composite component
body: <p>I've been trying to create an own component to "replace" the Richfaces spacer, which is no longer available in Richfaces 4.</p>
  
  <p>I have found this link for the actual implementation: <a href="https://community.jboss.org/wiki/SpacerImplementationForJSF2OrRichFaces4" rel="nofollow">https://community.jboss.org/wiki/SpacerImplementationForJSF2OrRichFaces4</a></p>
  
  <p>I tried to register the new taglib:</p>
  
  <p>richext.taglib.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;facelet-taglib 
      xmlns="http://java.sun.com/xml/ns/javaee"
      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-facelettaglibrary_2_0.xsd"
      version="2.0"&gt;
  
  &lt;namespace&gt;http://java.sun.com/jsf/composite/richext&lt;/namespace&gt;
      &lt;tag&gt;
          &lt;tag-name&gt;spacer&lt;/tag-name&gt;
          &lt;source&gt;../richext/spacer.xhtml&lt;/source&gt;
      &lt;/tag&gt;
  </code></pre>
  
  <p></p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;javax.faces.FACELETS_LIBRARIES&lt;/param-name&gt;
      &lt;param-value&gt;WEB-INF/richext.taglib.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>changed the spacer.xhtml a little bit to:</p>
  
  <pre><code>&lt;composite:implementation&gt;
  
      &lt;h:panelGroup rendered="#{cc.attrs.height &gt; 0}"&gt;
          &lt;br/&gt;
      &lt;/h:panelGroup&gt;
  
      &lt;h:graphicImage value="../img/spacer.gif"
                      width="#{cc.attrs.width}px"
                      height="#{cc.attrs.height}px"/&gt;
  &lt;/composite:implementation&gt;
  </code></pre>
  
  <p>I added</p>
  
  <pre><code>xmlns:richext="http://java.sun.com/jsf/composite/richext"
  </code></pre>
  
  <p>to the pages where I want to use the spacer.</p>
  
  <p>My Files:
  WebContent/WEB-INF/richext.taglib.xml</p>
  
  <p>WebContent/richext/spacer.xhtml</p>
  
  <p>WebContent/img/spacer.gif</p>
  
  <p>Now, when accessing a page where I use the spacer (other pages work fine) I get a NullpointerException in the browser, not in the server log.</p>
  
  <pre><code>java.lang.NullPointerException
  at org.apache.myfaces.view.facelets.tag.composite.CompositeComponentDefinitionTagHandler.apply(CompositeComponentDefinitionTagHandler.java:113)
  at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:57)
  at org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)
  at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:394)
  at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:448)
  at org.apache.myfaces.view.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:390)
  at org.apache.myfaces.view.facelets.tag.UserTagHandler.apply(UserTagHandler.java:138)
  at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
  at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:59)
  at org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53)
  at org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:294)
  at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:54)
  at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
  at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:57)
  at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
  at org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)
  at org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:179)
  at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:417)
  at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:78)
  at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
  at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1188)
  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:763)
  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:454)
  at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
  at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)
  at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:919)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1016)
  at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
  at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)
  at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
  at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
  at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
  at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
  at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
  at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
  at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
  at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
  at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659)
  </code></pre>
  
  <p>Where did I go wrong? Am I missing something?</p>
  
  <p>My Server is a Websphere 8.0.0.2 if that's important.</p>
  
  <p>Thanks in advance</p>