2 Replies Latest reply on May 30, 2007 2:04 AM by mgrouch

    s:selectItems problem

    mgrouch Expert

      I get exception trying to use Seam s:selectItems.
      Entity Currency is EJB3 entity annotated with @Entity
      and had @Id of type String. What could be wrong here?


      org.hibernate.TransientObjectException: The instance was not associated with this session
      at org.hibernate.impl.SessionImpl.getIdentifier(SessionImpl.java:1375)
      at org.jboss.seam.persistence.HibernatePersistenceProvider.getId(HibernatePersistenceProvider.java:51)
      at org.jboss.seam.framework.EntityIdentifier.<init>(EntityIdentifier.java:15)
      at org.jboss.seam.ui.EntityConverterStore.put(EntityConverterStore.java:61)
      at org.jboss.seam.ui.EntityConverter.getAsString(EntityConverter.java:68)
      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:833)
      at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:286)
      at org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:347)
      at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:342)
      at org.ajax4jsf.framework.renderer.RendererBase.encodeChildren(RendererBase.java:121)
      at org.richfaces.renderkit.html.SimpleTogglePanelRenderer.encodeChildren(SimpleTogglePanelRenderer.java:181)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809)
      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:809)
      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:571)
      at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:232)
      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.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
      at org.jboss.seam.web.HttpAuthFilter.processBasicAuth(HttpAuthFilter.java:121)
      at org.jboss.seam.web.HttpAuthFilter.doFilter(HttpAuthFilter.java:79)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:59)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:264)
      at org.jboss.seam.web.AbstractAjax4jsfFilter.doFilter(AbstractAjax4jsfFilter.java:35)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
      at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:126)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:126)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:248)
      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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)




      <h:outputLabel for="selCcy" value="Currency" />
       <h:selectOneMenu id="selCcy" styleClass="selectOneMenu" required="false" value="#{productLookup.productCcy}">
       <s:selectItems value="#{staticData.currencies}" var="currency" label="#{currency.ccy} - #{currency.currencyDesc}" />
       <s:convertEntity />
       </h:selectOneMenu>
      


        • 1. Re: s:selectItems problem
          mgrouch Expert

          staticData is application scope

          I've turned off seam transaction management now as my
          StaticData class loads currencies by calling session EJB3 and relies on EJB3
          transaction management (CMT)

          Now I'm getting null pointer exception


          [java] java.lang.NullPointerException
          [java] at org.jboss.seam.framework.EntityIdentifier.<init>(EntityIdentifier.java:15)
          [java] at org.jboss.seam.ui.EntityConverterStore.put(EntityConverterStore.java:61)
          [java] at org.jboss.seam.ui.EntityConverter.getAsString(EntityConverter.java:68)
          [java] at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue(HtmlBasicRenderer.java:469)
          [java] at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOption(MenuRenderer.java:502)
          [java] at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:757)
          [java] at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:811)
          [java] at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:335)
          [java] at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:833)
          [java] at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:286)
          [java] at org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:262)
          [java] at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:347)
          [java] at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:342)
          [java] at org.ajax4jsf.framework.renderer.RendererBase.encodeChildren(RendererBase.java:121)
          [java] at org.richfaces.renderkit.html.SimpleTogglePanelRenderer.encodeChildren(SimpleTogglePanelRenderer.java:181)
          [java] at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809)
          [java] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
          [java] at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
          [java] at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809)
          [java] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
          [java] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
          [java] at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
          [java] at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
          [java] at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:232)
          [java] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
          [java] at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
          [java] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
          [java] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
          [java] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          [java] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          [java] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          [java] at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64)
          [java] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          [java] at org.jboss.seam.web.HttpAuthFilter.processBasicAuth(HttpAuthFilter.java:121)
          [java] at org.jboss.seam.web.HttpAuthFilter.doFilter(HttpAuthFilter.java:79)
          [java] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          [java] at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:59)
          [java] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          [java] at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
          [java] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          [java] at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
          [java] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          [java] at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:264)
          [java] at org.jboss.seam.web.AbstractAjax4jsfFilter.doFilter(AbstractAjax4jsfFilter.java:35)
          [java] at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          [java] at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:126)
          [java] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          [java] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          [java] at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:126)
          [java] at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:248)
          [java] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          [java] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          [java] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          [java] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          [java] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          [java] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
          [java] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
          [java] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
          [java] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
          [java] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
          [java] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
          [java] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
          [java] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
          [java] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          [java] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
          [java] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
          [java] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
          [java] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          [java] at java.lang.Thread.run(Thread.java:595)


          • 2. Re: s:selectItems problem
            mgrouch Expert

            The line exception is coming from EntityIdentifier.java


            super(Entity.forClass(deproxy(entity.getClass())).getBeanClass(), PersistenceProvider.instance().getId(entity, entityManager));


            I do not use entity manager.