0 Replies Latest reply on Oct 27, 2008 7:49 AM by Miguel Angel Goicochea

    PropertyNotFound exception when I link to another page

    Miguel Angel Goicochea Newbie

      Hello I am getting an error when I click a s:link component that links to a maintenance page.


      I don't understand where the error may be, so any help will be welcomed. I am attaching all the information I think is necessary, but if you need anything else just ask me, this is just a toy project I am doing in order to learn how to use JBoss Seam.




      Here is the ItemSearch.xthml code that launches the action:


      <h:column>
           <f:facet name="header">
                Code
           </f:facet>
           <s:link value="#{item.itemCode}" id="editItem" view="/maintenance/ItemMaintenance.xhtml">
                <f:param name="itemId" value="#{item.id}" />
           </s:link>
      </h:column>
      



      This is the source of the ItemHome.java file


      package sm.action.home;
      
      import org.hibernate.validator.InvalidStateException;
      import org.hibernate.validator.InvalidValue;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityHome;
      import org.jboss.seam.framework.EntityNotFoundException;
      import org.jboss.seam.log.Log;
      
      import sm.model.entities.Item;
      
      @Name("itemHome")
      public class ItemHome extends EntityHome<Item>
      {
           private static final long serialVersionUID = -3313501824840400038L;
           @Logger
           Log log;
      
           @Override
           protected Item createInstance()
           {
                log.info("Creando Instancia");
                Item item = new Item();
                return item;
           }
      
           public void setItemId(Long id)
           {
                setId(id);
           }
      
           public Long getItemid()
           {
                return (Long) getId();
           }
      
           public void wire()
           {
                getInstance();
           }
      
           public boolean isWired()
           {
                return true;
           }
      
           public Item getDefinedInstance()
           {
                return isIdDefined() ? getInstance() : null;
           }
      
           @Override
           public String persist()
           {
                try
                {
                     return super.persist();
                }
                catch (InvalidStateException ise)
                {
                     for (InvalidValue iv : ise.getInvalidValues())
                     {
                          log.info("Propiedad #0 :: ToString= #1", iv.getPropertyName(), iv.toString());
                     }
                     log.info(ise);
      
                }
                catch (Exception ex)
                {
                     log.warn("Excepción no contemplada");
                     log.info(ex);
                     log.info(ex.getStackTrace());
                }
      
                return "";
           }
      
           @Override
           public String update()
           {
                try
                {
                     return super.persist();
                }
                catch (InvalidStateException ise)
                {
                     for (InvalidValue iv : ise.getInvalidValues())
                          log.info("Propiedad #0 ;; ToString= #1", iv.getPropertyName(), iv.toString());
                     log.info(ise);
                }
                catch (Exception ex)
                {
                     log.warn("Excepción no contemplada");
                     log.info(ex);
                     log.info(ex.getStackTrace());
                }
      
                return "";
           }
      
           public String loadEntity()
           {
                log.info("entró al método loadEntity()");
                Long id = getItemid();
                String result = "valid";
                
                if (id != null)
                {
                     try
                     {
                          this.getInstance();
                          if (!isManaged()) result = "invalid";
                     }
                     catch (EntityNotFoundException e)
                     {
                          result = "invalid";
                     }
                }
                log.info("Se terminó de ejecutar loadEntity()");
                return result;
           }
      
      }
      



      This is the page.xml for ItemMaintenance



      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
      
           <param name="itemId" value="#{itemHome.itemId}"/>
           <action execute="#{itemHome.loadEntity}" />
           
           <navigation from-action="#{itemHome.loadEntity}">
            <rule if-outcome="invalid">
               <redirect view-id="/maintenance/ItemSearch.xhtml">
                  <message severity="WARN">
                    The item you requested does not exist.
                  </message>
               </redirect>
             </rule>
          </navigation>
      
           <navigation from-action="#{itemHome.persist}">
                <end-conversation />
                <redirect view-id="/maintenance/ItemSearch.xhtml" />
           </navigation>
      
           <navigation from-action="#{itemHome.update}">
                <end-conversation />
                <redirect view-id="/maintenance/ItemSearch.xhtml" />
           </navigation>
      
           <navigation from-action="#{itemHome.remove}">
                <end-conversation />
                <redirect view-id="/maintenance/ItemSearch.xhtml" />
           </navigation>
      
      </page>






      This is the code for the property in Item.java



      @Entity
      @Name("item")
      @Table(name = "item", schema = AppConst.defaultSchema, uniqueConstraints = { @UniqueConstraint(columnNames = "item_code") })
      public class Item
      {
           private Long id;
           private String itemCode;
           private String itemName;
           private String itemDesc;
           private Integer amount;
      
           @Embedded
           private AuditFields auditFields;
      
           @Logger
           Log log;
      
           @Id
           @GeneratedValue(generator = "item_id", strategy = GenerationType.SEQUENCE)
           @SequenceGenerator(name = "item_id", sequenceName = AppConst.defaultSchema + ".item_item_id_seq", allocationSize = 0)
           @Column(name = "item_id")
           @NotNull
           public Long getId()
           {
                return id;
           }
      
           public void setId(Long id)
           {
                this.id = id;
           }
      
              // More Code
      
      }
      



      and finally this is the stack trace:



      01:11:14,312 ERROR [STDERR] 27/10/2008 01:11:14 AM com.sun.facelets.FaceletViewHandler handleRenderException
      GRAVE: Error Rendering View[/maintenance/ItemMaintenance.xhtml]
      javax.el.PropertyNotFoundException: Property 'itemId' not readable on type java.lang.Long
           at javax.el.BeanELResolver$BeanProperty.read(BeanELResolver.java:259)
           at javax.el.BeanELResolver$BeanProperty.access$000(BeanELResolver.java:209)
           at javax.el.BeanELResolver.getValue(BeanELResolver.java:60)
           at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
           at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
           at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
           at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
           at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
           at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:111)
           at org.jboss.seam.navigation.Param.getStringValueFromModel(Param.java:133)
           at org.jboss.seam.navigation.Pages.updateStringValuesInPageContextUsingModel(Pages.java:837)
           at org.jboss.seam.jsf.SeamStateManager.saveSerializedView(SeamStateManager.java:61)
           at org.ajax4jsf.application.AjaxStateManager.saveSerializedView(AjaxStateManager.java:317)
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:615)
           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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           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:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           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.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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           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:595)