6 Replies Latest reply on May 17, 2006 8:02 AM by Bradley Smith

    IllegalArgumentException: could not set field value: linkEdi

    Bradley Smith Master

      Hello,

      I am having a problem with @Injection (I think). Here is the source code (Facelets XHTML) for an HTML form:


      <ui:composition>
       <h:form>
       <h:inputHidden id="id" value="#{link.id}"/>
       <div>
       <span class="label"><h:outputLabel for="url">URL:</h:outputLabel></span>
       <span class="input">
       <h:inputText id="url" value="#{link.URL}"/><br/>
       <span class="errors"><h:message for="URL"/></span>
       </span>
       </div>
      
       <div>
       <span class="label"><h:outputLabel for="title">Link Title:</h:outputLabel></span>
       <span class="input">
       <h:inputText id="title" value="#{link.title}"/><br/>
       <span class="errors"><h:message for="title"/></span>
       </span>
       </div>
      
       <div class="entry errors"><h:messages globalOnly="true"/></div>
       <c:choose>
       <c:when test="#{link.id gt 0}">
       <h:commandButton value=" save changes " action="#{linkEditor.updateLink}" class="button"/>
       </c:when>
       <c:otherwise>
       <h:commandButton value=" create link " action="#{linkCreator.createLink}" class="button"/>
       </c:otherwise>
       </c:choose>
       <f:verbatim> </f:verbatim>
      
       <script type="text/javascript" language="javascript">
       function gotoPage(pageUrl) {
       if (pageUrl) {
       window.location.pathname = pageUrl;
       }
       }
       </script>
       <h:commandButton value=" cancel " type="button" onclick="gotoPage('/userlinks/main.seam');"/>
       </h:form>
      </ui:composition>
      


      Here is the generated source:

      <form id="_id0" method="post" action="/userlinks/edit-link.seam" enctype="application/x-www-form-urlencoded">
      <input id="_id0:id" type="hidden" name="_id0:id" value="20" />
       <div>
       <span class="label"><label for="_id0:url">
      URL:</label></span>
       <span class="input"><input id="_id0:url" type="text" name="_id0:url" value="http://www.boston.com/" /><br />
       <span class="errors"></span>
       </span>
       </div>
      
       <div>
       <span class="label"><label for="_id0:title">
      Link Title:</label></span>
       <span class="input"><input id="_id0:title" type="text" name="_id0:title" value="boston" /><br />
       <span class="errors"></span>
       </span>
       </div>
      
       <div class="entry errors"></div><input type="submit" name="_id0:_id16" value=" save changes " class="button" />
      
       <script type="text/javascript" language="javascript">
       function gotoPage(pageUrl) {
       if (pageUrl) {
       window.location.pathname = pageUrl;
       }
       }
       </script><input type="button" name="_id0:_id19" value=" cancel " onclick="gotoPage('/userlinks/main.seam');" /> <input type="hidden" name="com.sun.faces.VIEW" value="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" />
       <input type="hidden" name="_id0" value="_id0" /></form>
      


      Here is the component that responds to submits from this form:

      
      @Name("linkEditor")
      @Scope(ScopeType.CONVERSATION)
      public class LinkEditor {
      
       private Log log = LogFactory.getLog(UserLinkActions.class);
      
       // Resources
       @In(create = true)
       private Session appssoDB;
      
       // Entities
       @In(create = false,required = true)
       @Out(scope = ScopeType.SESSION, value = "user")
       private User user;
      
       @In(create = true) @Out
       private Link link;
      
       @RequestParameter("id")
       private long linkId;
      
       // UI, Misc...
       @In(create = true)
       private FacesMessages facesMessages;
      
       @End(ifOutcome={"success"})
       public String createLink() {
      
       log.info("createLink() - entered");
       final User u = (User) appssoDB.get(User.class, user.getId());
       if (u != null) {
       Transaction tx = appssoDB.beginTransaction();
       if (link != null)
       u.addLink(link);
       link.initDates();
       appssoDB.save(u);
       tx.commit();
       appssoDB.refresh(u);
       user = u;
       return "success";
       } else {
       facesMessages.add("User does not exist in database.");
       return null;
       }
       }
      
       public String updateLink() {
       log.info("updateLink() - link.id="+linkId);
       if (link != null || link.getId()>0) {
       final Link l = getLink(link.getId(),user.getId());
       if (l != null ) {
       l.setTitle(link.getTitle());
       l.setRank(link.getRank());
       l.setURL(link.getURL());
       l.refreshUpdateDate();
       user.addLink(l);
       appssoDB.save(user);
       appssoDB.refresh(user);
       link = user.getLink(link.getId());
       return "success";
       }
       }
       facesMessages.add("Unable to update requested link.");
       return null;
       }
      
       public String deleteLink() {
       log.info("deleteLink() - linkId="+linkId);
       link = getLink(linkId,user.getId());
       log.info(" link -> "+link);
       if (link != null) {
       Transaction tx = appssoDB.beginTransaction();
       link.getUser().removeLink(link);
       appssoDB.save(link.getUser());
       tx.commit();
       user = (User)appssoDB.get(User.class, user.getId());
       return "success";
       } else {
       facesMessages.add("Unable to delete requested link.");
       return null;
       }
       }
      
       public String readLink() {
       link = getLink(linkId,user.getId());
       log.info("getLink() - link -> "+link);
       if (link != null) {
       return "success";
       } else {
       facesMessages.add("Unable to load requested link.");
       return null;
       }
       }
      
       /** The link we are editting must be associated with a particular user.
       *
       * @return a link
       */
       private Link getLink(long lid, long uid) {
       log.info("getLink() - lid="+lid+"\tuser.id="+uid);
       return (Link)appssoDB.createQuery("from Link as link where link.user.id=:uid and link.id=:lid")
       .setParameter("lid",lid)
       .setParameter("uid",uid)
       .uniqueResult();
       }
      }
      


      Here is the problem -

      The form's submit button in this case is wired to the linkEditor.updateLink action. When I submit the form, I get the following stack trace:


      08:07:02,190 ERROR [InvokeApplicationPhase] #{linkEditor.updateLink}: javax.faces.el.EvaluationException: /edit-link.xhtml @51,99 action="#{linkEditor.updateLink}": java.lang.IllegalArgumentException:
       could not set field value: linkEditor.id
      javax.faces.FacesException: #{linkEditor.updateLink}: javax.faces.el.EvaluationException: /edit-link.xhtml @51,99 action="#{linkEditor.updateLink}": java.lang.IllegalArgumentException: could not set f
      ield value: linkEditor.id
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
       at javax.faces.component.UICommand.broadcast(UICommand.java:312)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:441)
       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.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
       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.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(Thread.java:595)
      Caused by: javax.faces.el.EvaluationException: /edit-link.xhtml @51,99 action="#{linkEditor.updateLink}": java.lang.IllegalArgumentException: could not set field value: linkEditor.id
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
       ... 35 more
      Caused by: java.lang.IllegalArgumentException: could not set field value: linkEditor.id
       at org.jboss.seam.Component.setFieldValue(Component.java:1068)
       at org.jboss.seam.Component.injectParameters(Component.java:723)
       at org.jboss.seam.Component.inject(Component.java:698)
       at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:30)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:68)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:34)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
       at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
       at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:51)
       at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:39)
       at com.evergreen.userlinks.biz.LinkEditor$$EnhancerByCGLIB$$201d8ec8.updateLink(<generated>)
       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:585)
       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)
       ... 36 more
      Caused by: java.lang.IllegalArgumentException
       at sun.reflect.UnsafeLongFieldAccessorImpl.set(UnsafeLongFieldAccessorImpl.java:62)
       at java.lang.reflect.Field.set(Field.java:656)
       at org.jboss.seam.Component.setFieldValue(Component.java:1064)
       ... 91 more
      08:07:02,190 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
      javax.servlet.ServletException: #{linkEditor.updateLink}: javax.faces.el.EvaluationException: /edit-link.xhtml @51,99 action="#{linkEditor.updateLink}": java.lang.IllegalArgumentException: could not s
      et field value: linkEditor.id
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:441)
       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.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
       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.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(Thread.java:595)
      08:07:02,206 ERROR [SeamExceptionFilter] could not roll back transaction
      java.lang.ClassCastException: org.jboss.tm.usertx.client.ServerVMClientUserTransaction
       at org.jboss.seam.util.Transactions.getUserTransaction(Transactions.java:48)
       at org.jboss.seam.util.Transactions.isTransactionActiveOrMarkedRollback(Transactions.java:35)
       at org.jboss.seam.servlet.SeamExceptionFilter.rollbackAfterException(SeamExceptionFilter.java:77)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:50)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:441)
       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.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
       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.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(Thread.java:595)
      08:07:02,206 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.FacesException: #{linkEditor.updateLink}: javax.faces.el.EvaluationException: /edit-link.xhtml @51,99 action="#{linkEditor.updateLink}": java.lang.IllegalArgumentException: could not set f
      ield value: linkEditor.id
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
       at javax.faces.component.UICommand.broadcast(UICommand.java:312)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:441)
       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.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
       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.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(Thread.java:595)
      Caused by: javax.faces.el.EvaluationException: /edit-link.xhtml @51,99 action="#{linkEditor.updateLink}": java.lang.IllegalArgumentException: could not set field value: linkEditor.id
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
       ... 35 more
      Caused by: java.lang.IllegalArgumentException: could not set field value: linkEditor.id
       at org.jboss.seam.Component.setFieldValue(Component.java:1068)
       at org.jboss.seam.Component.injectParameters(Component.java:723)
       at org.jboss.seam.Component.inject(Component.java:698)
       at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:30)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:68)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:34)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
       at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
       at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:51)
       at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:39)
       at com.evergreen.userlinks.biz.LinkEditor$$EnhancerByCGLIB$$201d8ec8.updateLink(<generated>)
       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:585)
       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)
       ... 36 more
      Caused by: java.lang.IllegalArgumentException
       at sun.reflect.UnsafeLongFieldAccessorImpl.set(UnsafeLongFieldAccessorImpl.java:62)
       at java.lang.reflect.Field.set(Field.java:656)
       at org.jboss.seam.Component.setFieldValue(Component.java:1064)
       ... 91 more
      


      I am using JBoss 4.0.4.CR2, Seam 1.0.0.CR1, etc...
      Also, this same form works fine when I invoke the createLink method in another component (see the c:choose usage above).

      Help!

      Thanks.

        • 1. Re: IllegalArgumentException: could not set field value: lin
          Gavin King Master

          Strange.

          Put a breakpoint in Component.setFieldValue() and see what you got.

          And beware of classloading problems!

          • 2. Re: IllegalArgumentException: could not set field value: lin
            Bradley Smith Master

            Some further digging....

            Here is the what comes in with the request when this submit is invoked:

            16:06:48,740 INFO [RequestDumper] _id0:title = Jboss Seam Forum Site
            16:06:48,740 INFO [RequestDumper] _id0:id = 27
            16:06:48,740 INFO [RequestDumper] _id0:url = http://www.jboss.com/index.html?module=bb&op=viewforum&f=231
            16:06:48,740 INFO [RequestDumper] _id0 = _id0
            16:06:48,740 INFO [RequestDumper] com.sun.faces.VIEW = H4sIAAAAAAAAAMVXX2wURRifu7a0XAFbCqSCpUdBCtjutfSOthaUlrb04hVqWyp/HmDudnq3sLe77s72thIJPKCJJEZFjCY1kuiDD/iibyYmGh6MJGAg8cXEhBgTY+KfxBfUB/Wb2b293ft
            jC0LYh7m9me+b79/v .. PRUNED.. LJYV/tLZvHygfM1d2wi7E+i8oJYVucxIAAA==
            16:06:48,740 INFO [RequestDumper] _id0:_id16 = save changes
            16:06:48,740 INFO [RequestDumper] ------------------------------------------------------------------------------------------------------------------------
            


            Here is what Seam thinks it has to work with (I added some logging to org.jboss.seam.Component.setFieldValue(Object bean, Field field, String name, Object value) {} in the catch{} block.

            16:06:48,771 ERROR [Component] java.lang.IllegalArgumentException
            java.lang.IllegalArgumentException
             at sun.reflect.UnsafeLongFieldAccessorImpl.set(UnsafeLongFieldAccessorImpl.java:62)
             at java.lang.reflect.Field.set(Field.java:656)
             at org.jboss.seam.Component.setFieldValue(Component.java:1081)
             at org.jboss.seam.Component.injectParameters(Component.java:737)
             at org.jboss.seam.Component.inject(Component.java:712)
             at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:30)
            ...
            ...
            16:06:48,771 ERROR [Component] getFieldValue() - bean -> com.evergreen.userlinks.biz.LinkEditor$$EnhancerByCGLIB$$6e6c844e@1727596
            16:06:48,771 ERROR [Component] getFieldValue() - field -> private long com.evergreen.userlinks.biz.LinkEditor.linkId
            16:06:48,771 ERROR [Component] getFieldValue() - name -> id
            16:06:48,771 ERROR [Component] getFieldValue() - value -> nullnull
            


            Any thoughts?

            Thanks.

            • 3. Re: IllegalArgumentException: could not set field value: lin
              Bradley Smith Master

              One more thing... I showed the source (actual and generated) above. I invoke the display of this form the following way:



               <h:commandLink action="#{linkEditor.readLink}">
               <h:outputText value="edit"/>
               <f:param name="id" value="#{curLink.id}"/>
               </h:commandLink>
              


              Thanks.

              • 4. Re: IllegalArgumentException: could not set field value: lin
                Bradley Smith Master

                I solved this.

                The root of the problem was that I was:

                a.) using the @RequestParameter annotation
                b.) trying to use different methods in the same class, LinkEditor, to handle the different functions (events) related to editting links in my application.

                This suggests that I would need to create a separate class for each of my use cases unless they shared exactly the same (@)Injection state.
                In other words, for my 'read' and 'delete' use cases, I need the id of the desired link entity, so I used the @RequestParameter.
                When I update the link, this same request parameter was not in my form and thus I ran into the exception.

                I wonder if it makes sense to add an 'optional' or 'required' parameter to the @RequestParameter...?

                Also, Gavin, I wonder if you have some suggestions for how to organize
                and group related code since it seems like using a single class to
                encapsulate related methods might not be best..? (the 'best practices' stuff)

                Thanks.

                • 5. Re: IllegalArgumentException: could not set field value: lin
                  Gavin King Master

                  What happens if you use Long instead of long?