java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • See minimal example bean here: https://gist.github.com/4483188 or end of description. Used with: <h:inputText binding="#{exampleBean.text}" value="hi"></h:inputText> Note that my actual use case is rather constructing a whole table this way including inputTexts as children. It was however reproduce-able with just this sample. Stacktrace in first comment. package test; import javax.annotation.PostConstruct; import javax.enterprise.inject.Model; import javax.faces.component.behavior.AjaxBehavior; import javax.faces.component.html.HtmlInputText; import javax.faces.context.FacesContext; import javax.faces.event.AbortProcessingException; import javax.faces.event.AjaxBehaviorEvent; import javax.faces.event.AjaxBehaviorListener; @Model public class ExampleBean implements AjaxBehaviorListener { private HtmlInputText text; public HtmlInputText getText() { return text; } public void setText(HtmlInputText text) { this.text = text; } @Override public void processAjaxBehavior(AjaxBehaviorEvent event) throws AbortProcessingException { System.out.println("Ajax call"); } @PostConstruct private void setup() { HtmlInputText inputText = (HtmlInputText) FacesContext .getCurrentInstance().getApplication() .createComponent(HtmlInputText.COMPONENT_TYPE); AjaxBehavior ajaxBehavior = (AjaxBehavior) FacesContext .getCurrentInstance().getApplication() .createBehavior(AjaxBehavior.BEHAVIOR_ID); inputText.setId("input"); ajaxBehavior.addAjaxBehaviorListener(this); ajaxBehavior.setTransient(true); ajaxBehavior.setDisabled(false); inputText.addClientBehavior("focus", ajaxBehavior); text = inputText; } }
    via by karlkilden,
    • java.lang.NullPointerException at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.decodeBehaviors(HtmlBasicRenderer.java:215) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.decode(HtmlBasicRenderer.java:117) at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787) at javax.faces.component.UIInput.decode(UIInput.java:757) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1181) at javax.faces.component.UIInput.processDecodes(UIInput.java:662) at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:506) at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1612) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) at javax.faces.component.UIForm.visitTree(UIForm.java:371) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376) at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:252) at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:199) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931) at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
    No Bugmate found.