5 Replies Latest reply on Feb 24, 2008 9:59 PM by Wayne Hannam

    Exception while trying to iterate over List

    Wayne Hannam Newbie

      I am new to Seam, and getting an exception while attempting to use a ui:repeat tag to iterate over a List contained in a stateful session bean


      Here is the bean


      @Stateful
      
      @Scope(ScopeType.SESSION)
      
      @Name("employerManager")
      
      public class EmployerManagerImpl implements EmployerManager {
      
      
           @PersistenceContext
      
           EntityManager em;
      
           
      
           @In @Out
      
           private Employer employer=new Employer();
      
           
      
           private List<Employer> employers;
      
           
      
           /**
      
            * Add employer to database
      
            * @return The faces page name of the next view
      
            */
      
           public String add() {
      
                em.persist(employer);
      
                return("addemployerdone");
      
           }
      
      
           /**
      
            * Delete employer from database
      
            * @return The faces page name of the next view
      
            */     
      
           public String delete() {
      
                em.remove(employer);
      
                return ("deleteemployerdone");
      
           }
      
      
           /**
      
            * Update employer in database
      
            * @return The faces page name of the next view
      
            */     
      
           public String update() {
      
                em.merge(employer);
      
                return ("updateemployerdone");
      
           }
      
      
           @Create
      
           @SuppressWarnings("unchecked")
      
           public void find() {
      
                employers = em.createQuery("select e from Employer e").getResultList();
      
           }
      
           
      
           /**
      
            * 
      
            */
      
           @Remove @Destroy
      
           public void destroy() {
      
           }
      
           
      
           /**
      
            * @return Collection containing all employers
      
            */
      
           public List<Employer> getEmployers()
      
           {
      
                return employers;
      
           }
      
      }



      Here is the page snippit


                      <ui:repeat value="#{employerManager.employers}" var="emp">
      
                          <f:verbatim>#{emp.name}</f:verbatim>
      
                      </ui:repeat>



      Here is the exception


      SEVERE: Error Rendering View[/admin/location.xhtml]
      
      javax.faces.el.EvaluationException: javax.el.ELException: /admin/location.xhtml
      
      @22,75 value="#{employerManager.employers}": Error reading 'employers' on type o
      
      rg.javassist.tmp.java.lang.Object_$$_javassist_0
      
              at javax.faces.component.ValueBindingValueExpressionAdapter.getValue(Val
      
      ueBindingValueExpressionAdapter.java:106)
      
              at com.sun.facelets.component.UIRepeat.getValue(UIRepeat.java:143)
      
              at com.sun.facelets.component.UIRepeat.getDataModel(UIRepeat.java:121)
      
              at com.sun.facelets.component.UIRepeat.setIndex(UIRepeat.java:305)
      
              at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:333)
      
              at com.sun.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:617)
      
      
              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.jav
      
      a:592)
      
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePha
      
      se.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(Appl
      
      icationFilterChain.java:290)
      
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      
      ilterChain.java:206)
      
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter
      
      .java:83)
      
              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.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.doFilter(SeamFilter.java:158)
      
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      
      icationFilterChain.java:235)
      
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      
      ilterChain.java:206)
      
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
      
      lter.java:96)
      
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      
      icationFilterChain.java:235)
      
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      
      ilterChain.java:206)
      
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
      
      alve.java:230)
      
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
      
      alve.java:175)
      
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
      
      yAssociationValve.java:179)
      
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
      
      e.java:84)
      
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
      
      ava:127)
      
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
      
      ava:102)
      
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
      
      onnectionValve.java:157)
      
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
      
      ve.java:109)
      
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
      
      a:262)
      
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
      
      :844)
      
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
      
      ss(Http11Protocol.java:583)
      
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
      
      6)
      
              at java.lang.Thread.run(Thread.java:595)



      Any help would be greatly appreciated