3 Replies Latest reply on Mar 5, 2008 6:12 PM by Gavin Ellis

    Using convertEntity tag causes NullPointerException

    Gavin Ellis Newbie

      I am trying to use the


      <s:converEntity>


      tag as follows:



      
                        <h:selectManyListbox value="#{user.roles}" id="selectRolesMenu" required="true">
      
                             <s:selectItems value="#{roles}" var="role" label="#{role.name}"/>
      
                             <s:convertEntity/>
      
                        </h:selectManyListbox>
      
      



      I have configured this to work with hibernate session management in components.xml as follows:


      
      <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
      
          <persistence:managed-hibernate-session name="session" auto-create="true"
      
                        session-factory-jndi-name="java:/hibernateSessionFactory"/>
      
      
               <component name="org.jboss.seam.ui.converter.EntityConverter">
      
             <property name="session">#{hibernateSession}</property>
      
           </component>
      
      



      as detailed in the documentation. When I then try to access the page with the listbox a NullPointerException is thrown (show below). Is there some configuration I'm missing here?


      
      SEVERE: Error Rendering View[/user.xhtml]
      
      java.lang.NullPointerException
      
           at org.jboss.seam.ui.converter.EntityConverterStore.getEntityManager(EntityConverterStore.java:81)
      
           at org.jboss.seam.ui.converter.EntityConverterStore.put(EntityConverterStore.java:60)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:597)
      
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
      
           at org.jboss.seam.util.Work.workInTransaction(Work.java:40)
      
           at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
      
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
      
           at org.jboss.seam.ui.converter.EntityConverterStore_$$_javassist_6.put(EntityConverterStore_$$_javassist_6.java)
      
           at org.jboss.seam.ui.converter.EntityConverter.getAsString(EntityConverter.java:67)
      
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue(HtmlBasicRenderer.java:469)
      
           at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOption(MenuRenderer.java:502)
      
           at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:757)
      
           at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:811)
      
           at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:335)
      
           at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
      
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:279)
      
           at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
      
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      
           at org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:186)
      
           at org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
      
           at org.jboss.seam.ui.renderkit.ValidateAllRendererBase.doEncodeChildren(ValidateAllRendererBase.java:33)
      
           at org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
      
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
      
           at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
      
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
      
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
      
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      
           at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      
           at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
      
           at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
      
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
      
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      
           at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
      
           at org.jboss.web.tomcat.security.FormAuthValve.invoke(FormAuthValve.java:78)
      
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      
           at java.lang.Thread.run(Thread.java:619)