14 Replies Latest reply on Feb 18, 2007 5:16 AM by Pete Muir

    s:selectItems - whto work

    Lawrie Gallardo Newbie

      Hi,

      I'm having problems getting s:selectItems and ec:convertEntity to work, and wondered if anyone had any suggestions?

      When I run my app, if I select any item from the drop-down (apart from the noSelectionLabel item) then I get an "value is not valid" validation message when I save. If I don't select an item (i.e. leave the noSelectionLabel item selected) then I get an exception (detailed below). Can anyone shed any light on why s:selectItems isn't working for me?

      CustomerEdit.xhtml

      <h:selectOneMenu value="#{customerHome.instance.status}" id="status">
       <s:selectItems value="#{statuses.resultList}" var="status" label="#{status.description}" noSelectionLabel="Please Select..." />
       <ec:convertEntity />
      </h:selectOneMenu>


      CustomerHome.java
      @Name("customerHome")
      public class CustomerHome extends EntityHome<Customer> {
      
       public void setCustomerId(Integer id) {
       setId(id);
       }
      
       public Integer getCustomerId() {
       return (Integer) getId();
       }
      
       @Override
       protected Customer createInstance() {
       Customer customer = new Customer();
       return customer;
       }
      
       public Customer getManagedInstance() {
       return isManaged() ? getInstance() : null;
       }
      
       public List<Activity> getActivities() {
       return getInstance() == null ? null : new ArrayList<Activity>(
       getInstance().getActivities());
       }
      
      }


      Customer.java
      @Entity
      @Table(name = "CUSTOMER", catalog = "CustomerBuilder")
      public class Customer implements java.io.Serializable {
      
       private int id;
       private String name;
       private String description;
       private Status status;
       private Set<Activity> activities = new HashSet<Activity>(0);
      
       public Customer() {
       }
      
       public Customer(int id, String name, Status status) {
       this.id = id;
       this.name = name;
       this.status = status;
       }
       public Customer(int id, String name, String description, Status status,
       Set<Activity> activities) {
       this.id = id;
       this.name = name;
       this.description = description;
       this.status = status;
       this.activities = activities;
       }
      
       @Id @GeneratedValue
       @Column(name = "ID", unique = true, nullable = false)
       @NotNull
       public int getId() {
       return this.id;
       }
      
       public void setId(int id) {
       this.id = id;
       }
      
       @Column(name = "NAME", nullable = false, length = 50)
       @NotNull
       @Length(max = 50)
       public String getName() {
       return this.name;
       }
      
       public void setName(String name) {
       this.name = name;
       }
      
       @Column(name = "DESCRIPTION")
       public String getDescription() {
       return this.description;
       }
      
       public void setDescription(String description) {
       this.description = description;
       }
      
       @ManyToOne(fetch = FetchType.LAZY)
       @JoinColumn(name = "STATUS_ID", nullable = false)
       @NotNull
       public Status getStatus() {
       return this.status;
       }
      
       public void setStatus(Status status) {
       this.status = status;
       }
      
       @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
       public Set<Activity> getActivities() {
       return this.activities;
       }
      
       public void setActivities(Set<Activity> activities) {
       this.activities = activities;
       }
      
      }


      Status.java
      @Entity
      @Name("status")
      @Table(name = "REF_STATUS", catalog = "CustomerBuilder")
      public class Status implements java.io.Serializable {
      
       private int id;
       private String description;
      
       public Status() {
       }
      
       public Status(int id, String description) {
       this.id = id;
       this.description = description;
       }
      
       @Id
       @Column(name = "ID", unique = true, nullable = false)
       @NotNull
       public int getId() {
       return this.id;
       }
      
       public void setId(int id) {
       this.id = id;
       }
      
       @Column(name = "DESCRIPTION", nullable = false, length = 50)
       @NotNull
       @Length(max = 50)
       public String getDescription() {
       return this.description;
       }
      
       public void setDescription(String description) {
       this.description = description;
       }
      }



      components.xml
      ...
       <framework:entity-query name="statuses" ejbql="select status from Status status" />
       ...


      Exception:
      javax.servlet.ServletException: Error calling action method of component with id customer:save
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:42)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)
      13:46:01,298 ERROR [ExceptionFilter] exception root cause
      javax.faces.FacesException: Error calling action method of component with id customer:save
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
       at javax.faces.component.UICommand.broadcast(UICommand.java:106)
       at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
       at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:42)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)
      Caused by: javax.faces.el.EvaluationException: /CustomerEdit.xhtml @347,61 action="#{customerHome.persist}": javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.jaywing.commsbuilder.Customer.status
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
       ... 32 more
      Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.jaywing.commsbuilder.Customer.status
       at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:647)
       at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
       at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:48)
       at org.jboss.seam.framework.EntityHome$$FastClassByCGLIB$$2a61cc01.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:36)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
       at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:145)
       at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:80)
       at com.jaywing.commsbuilder.CustomerHome$$EnhancerByCGLIB$$8492e8f2.persist(<generated>)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
       ... 33 more
      Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.jaywing.commsbuilder.Customer.status
       at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
       at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:284)
       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
       at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
       at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
       at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
       at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
       at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
       at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
       at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
       ... 60 more
      13:46:01,308 ERROR [DebugPageHandler] redirecting to debug page
      org.hibernate.PropertyValueException: not-null property references a null or transient value: com.jaywing.commsbuilder.Customer.status
       at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
       at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:284)
       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
       at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
       at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
       at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
       at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
       at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
       at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
       at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
       at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:48)
       at org.jboss.seam.framework.EntityHome$$FastClassByCGLIB$$2a61cc01.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:36)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
       at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:145)
       at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:80)
       at com.jaywing.commsbuilder.CustomerHome$$EnhancerByCGLIB$$8492e8f2.persist(<generated>)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
       at javax.faces.component.UICommand.broadcast(UICommand.java:106)
       at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
       at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:42)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)
      13:46:01,398 ERROR [ExceptionFilter] could not destroy contexts
      javax.servlet.ServletException: Error calling action method of component with id customer:save
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:42)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)
      13:46:01,408 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      java.lang.IllegalStateException: No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)
       at org.jboss.seam.contexts.PageContext.getPhaseId(PageContext.java:153)
       at org.jboss.seam.contexts.PageContext.isRenderResponsePhase(PageContext.java:165)
       at org.jboss.seam.contexts.PageContext.getCurrentReadableMap(PageContext.java:76)
       at org.jboss.seam.contexts.PageContext.get(PageContext.java:66)
       at org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:160)
       at org.jboss.seam.Component.getInstance(Component.java:1580)
       at org.jboss.seam.Component.getInstance(Component.java:1560)
       at org.jboss.seam.Component.getInstance(Component.java:1555)
       at org.jboss.seam.core.PersistenceContexts.instance(PersistenceContexts.java:45)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.entityRefsToIds(ManagedEntityIdentityInterceptor.java:49)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:42)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
       at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:145)
       at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:80)
       at com.jaywing.commsbuilder.StatusHome$$EnhancerByCGLIB$$8a690b94.clearDirty(<generated>)
       at org.jboss.seam.contexts.Lifecycle.isAttributeDirty(Lifecycle.java:506)
       at org.jboss.seam.contexts.ServerConversationContext.flush(ServerConversationContext.java:217)
       at org.jboss.seam.exceptions.DebugPageHandler.handle(DebugPageHandler.java:38)
       at org.jboss.seam.core.Exceptions.handle(Exceptions.java:70)
       at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:91)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:73)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)



        • 1. Re: s:selectItems - whto work
          Lawrie Gallardo Newbie

          I just updated seam from a CVS build on 10th Feb to the most recent nightly build and now I get the above exception (org.hibernate.PropertyValueException: not-null property references a null or transient value: com.jaywing.commsbuilder.Customer.status) whether or not I select an item in my drop-down.

          What I can't figure out is:
          1. Why the I now seemingly always get a null value set for status.
          2. Why before I upgraded to the latest nightly build I was getting a "value is not valid" when I selected an item in the drop-down.
          3. Also, why I'm getting an exception rather than a validation message.

          Any ideas? Are these issues with ec:convertEntity / s:selectItems, or is there somewhere I'm going wrong in my code?

          Thanks,
          Lawrie

          • 2. Re: s:selectItems - whto work
            Pete Muir Master

            Are you inside a conversation?

            • 3. Re: s:selectItems - whto work
              Lawrie Gallardo Newbie

              No - I just modified the seam-gen generated code (which just seems to use default scopes) and removed the following lines form my generated CustomerHome.java code (as I don't need status to be mutable)

              @In(value = "#{statusHome.managedInstance}", required = false)
               Status status;


              and
              public void wire() {
               if (status != null) {
               getInstance().setStatus(status);
               }
               }
              
               public boolean isWired() {
               if (getInstance().getStatus() == null)
               return false;
               return true;
               }



              • 4. Re: s:selectItems - whto work
                Lawrie Gallardo Newbie

                Sorry, what I meant was that my seam-gen generated CustomerHome class extends Seam Application Framework EntityHome (which, of course, has conversational scope).

                • 5. Re: s:selectItems - whto work
                  Pete Muir Master

                  Could you create a jira and attach a compileable, runnable project that shows the problem. Thanks :)

                  • 6. Re: s:selectItems - whto work
                    Jason Long Master

                    I am also having a problem, but mine is migrating from si:selectItems to s:selectItems.

                    My usage is below:

                    <h:selectOneMenu id="#{id}"
                     value="#{value}">
                     <s:selectItems value="#{selectItems}"
                     var="si"
                     label="#{si.label}"
                     noSelectionLabel="Select"/>
                     <ec:convertEntity />
                     </h:selectOneMenu>


                    If I change s:selectItems to si:selectItems then ec:convertEntity works correctly as converter="org.jboss.seam.EntityConverter" did before.

                    I have a page that has 11 select boxes all included by use of a custom facelets tag that includes the code above.

                    When I use s:selectItems i get the following error messages:
                    1. "Invalid selection. Selected item cannot be loaded from persistence context" -- This is for all entites except ones that are mapped by @Inheritance(strategy=InheritanceType.JOINED )
                    2. "value is not valid" -- this is what I get for entities that are mapped by @Inheritance(strategy=InheritanceType.JOINED )

                    Also I have two select boxes that are not loaded with the correct value when the page is displayed. All other have the correct values selected. These entities have a label like
                    @Transient
                    public String getLabel()
                    {
                     DecimalFormat df = new DecimalFormat("###,###,###,###,##0.000");
                     return df.format(this.size);
                    }


                    Any advice would be greatly appreciated. I will continue to use si:selectItems until I can resolve this, but I would like to remove the deprecated jars from my project.

                    • 7. Re: s:selectItems - whto work
                      Jason Long Master

                      I forgot to mention I am using Seam 1.1.6.

                      • 8. Re: s:selectItems - whto work
                        Pete Muir Master

                        For problem 1:

                        Is your SMPC called entityManager? If not are you correctly telling the entityConverter what it is called (see the wiki).

                        If you put a breakpoint at AbstractEntityConverter:170 can you check that (a) whether the correct Lookup is used and (b) whether the correct entityManager is used - and also whether the correct class is specified and the correct id.

                        Problem 2:

                        Not sure - I would suggest getting Problem 1 sorted first.

                        Problem 3:

                        Do you mean the label doesn't display correctly? Or that the wrong item is selected?

                        • 9. Re: s:selectItems - whto work
                          Jason Long Master

                          This is what I have for the entity manager in components.xml

                           <core:managed-persistence-context name="entityManager"
                           persistence-unit-jndi-name="java:/xxx.xxx.comEntityManagerFactory"/>
                          


                          A lot of my queries are loaded form SLSB DAOs that get their entity manager by
                           @PersistenceContext
                           public EntityManager entityManager;


                          Is there a better way to inject the entity manger that will us the SMPC or is it already using the SMPC?


                          • 10. Re: s:selectItems - whto work
                            Chuck Adams Novice

                            You need to use @In to inject a SMPC, not @PersistenceContext.

                            • 11. Re: s:selectItems - whto work
                              Chuck Adams Novice

                              The forum seems to have eaten my response, so I'll try again:

                              You need to use @In to inject the SMPC, not @PersistenceContext.

                              • 12. Re: s:selectItems - whto work
                                Chuck Adams Novice

                                And there was my previous reply. I sure can't wait for seam-forum to replace phpBB :P

                                • 13. Re: s:selectItems - whto work
                                  Jason Long Master

                                  I removed all of my

                                  @PersistenceContext


                                  in favor of

                                  @In(create=true)
                                  public EntityManager entityManager;


                                  I also replaced all
                                  @EJB


                                  with

                                  @In(create=true) MyDAO myDAO;


                                  This did make it work a little better.

                                  Then I stepped into AbstractEntityConverter and EntityConverter. I found that getAsObject was being passed what looked like my entity default toString. I then override toString with the following:

                                  public String toString()
                                   {
                                   return (id==null) ? null : id.toString();
                                   }


                                  Now it works correctly.

                                  It it necessary to implement toString on all my entites in this manner or did I configure something wrong? I did not change much as I had this working with si:selectItems.

                                  I also had to specify the entity class on my h:selectManyListbox . This was not necessary for si:selectItems. Is it planned to make this work the same way with s:selectItems?

                                  • 14. Re: s:selectItems - whto work
                                    Pete Muir Master

                                    Please wait for 1.1.7.GA or use Seam from CVS (sorry, this was a bug in 1.1.6.GA)