6 Replies Latest reply on Jul 31, 2008 5:44 PM by Alex Kavo

    Why SEAM sometimes cannot "set field value" while injecting a component

    Alex Kavo Novice

      Hello!


      I user the @In and @Out annotations. But sometimes I get this seam error:

      aused by: java.lang.IllegalArgumentException: could not set field value:

      Why does it happens? E.g. I couldn't set the variable
      @In(required=false)
      @Out(required=false)
      TaskInstance taskInstance

      How can I solve this problem?


      Kind regards

        • 2. Re: Why SEAM sometimes cannot "set field value" while injecting a component
          Alex Kavo Novice

          Ok, here is my class that needs the TaskInstance to be injected:

          @Name("processManager")
          public class ProcessManagerBean implements ProcessManager{
               
               @In(required = false)
                  JbpmContext jbpmContext;
               
                  @In
                  @Out
                  Actor actor;
          
                  @In(required=false)
                  @Out(required=false)
                  TaskInstance taskInstance
              
                  @In(required = false)
                  @Out(required = false)
               Identity identity;
               
               @In(required=false)
               @Out(required = false)
               SessionContext sessionContext;
               
               /**
                * Method starts a process.
                * @return
                */
               public String createProcess(String processName){
                  try{
                      BusinessProcess.instance()
                                     .createProcess(processName);
                      org.jboss.seam.bpm.ProcessInstance.instance().getContextInstance().setVariable("owner", sessionContext.get("company"));
                  }catch(Exception e){
                      FacesMessages.instance()
                                   .add(javax.faces.application.FacesMessage.SEVERITY_ERROR,
                          "Invalid Process Creation:\n" + e.getMessage());
                  }
                  
                  return "processStarted";
              }
          }


          Here is the stack trace
          java.lang.IllegalArgumentException: could not set field value: processManager.taskInstance
               at org.jboss.seam.Component.setFieldValue(Component.java:1792)
               at org.jboss.seam.Component.access$600(Component.java:139)
               at org.jboss.seam.Component$BijectedField.set(Component.java:2630)
               at org.jboss.seam.Component.injectAttributes(Component.java:1601)
                  ...
          com.sap.agora.bpm.ProcessManagerBean_$$_javassist_12.toString(ProcessManagerBean_$$_javassist_12.java)
               at com.sun.facelets.util.DevTools.writeVariables(DevTools.java:168)
               at com.sun.facelets.util.DevTools.writeVariables(DevTools.java:145)
               at com.sun.facelets.util.DevTools.debugHtml(DevTools.java:109)
               ...
          Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: ProcessManagerBean.taskInstance on: com.sap.agora.bpm.ProcessManagerBean with value: class org.jbpm.taskmgmt.exe.TaskInstance
               at org.jboss.seam.util.Reflections.set(Reflections.java:79)
               at org.jboss.seam.Component.setFieldValue(Component.java:1788)
               ... 64 more
          Caused by: java.lang.IllegalArgumentException: Can not set org.jboss.seam.bpm.TaskInstance field com.sap.agora.bpm.ProcessManagerBean.taskInstance to org.jbpm.taskmgmt.exe.TaskInstance
               at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
               at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
               at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
               at java.lang.reflect.Field.set(Unknown Source)
               at org.jboss.seam.util.Reflections.set(Reflections.java:64)
                  ...
               ... 65 more
          10:04:49,058 ERROR [ExceptionFilter] handling uncaught exception
          javax.servlet.ServletException: could not set field value: processManager.taskInstance
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
               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 java.lang.Thread.run(Unknown Source)
                  ...
          Caused by: java.lang.IllegalArgumentException: could not set field value: processManager.taskInstance
               at org.jboss.seam.Component.setFieldValue(Component.java:1792)
               at org.jboss.seam.Component.access$600(Component.java:139)
               at org.jboss.seam.Component$BijectedField.set(Component.java:2630)
               at org.jboss.seam.Component.injectAttributes(Component.java:1601)
                  ...
          com.sap.agora.bpm.ProcessManagerBean_$$_javassist_12.toString(ProcessManagerBean_$$_javassist_12.java)
               at com.sun.facelets.util.DevTools.writeVariables(DevTools.java:168)
               at com.sun.facelets.util.DevTools.writeVariables(DevTools.java:145)
               at com.sun.facelets.util.DevTools.debugHtml(DevTools.java:109)
               at com.sun.facelets.FaceletViewHandler.handleRenderException(FaceletViewHandler.java:692)
                  ...
               ... 37 more
          Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: ProcessManagerBean.taskInstance on: com.sap.agora.bpm.ProcessManagerBean with value: class org.jbpm.taskmgmt.exe.TaskInstance
               at org.jboss.seam.util.Reflections.set(Reflections.java:79)
               at org.jboss.seam.Component.setFieldValue(Component.java:1788)
               ... 64 more
          Caused by: java.lang.IllegalArgumentException: Can not set org.jboss.seam.bpm.TaskInstance field com.sap.agora.bpm.ProcessManagerBean.taskInstance to org.jbpm.taskmgmt.exe.TaskInstance
               at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
               at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
               at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
                  ...
               ... 65 more
          10:04:49,058 ERROR [ExceptionFilter] exception root cause
          java.lang.IllegalArgumentException: could not set field value: processManager.taskInstance
               at org.jboss.seam.Component.setFieldValue(Component.java:1792)
               at org.jboss.seam.Component.access$600(Component.java:139)
               at org.jboss.seam.Component$BijectedField.set(Component.java:2630)
               at org.jboss.seam.Component.injectAttributes(Component.java:1601)
                  ...
          com.sap.agora.bpm.ProcessManagerBean_$$_javassist_12.toString(ProcessManagerBean_$$_javassist_12.java)
               at com.sun.facelets.util.DevTools.writeVariables(DevTools.java:168)
               at com.sun.facelets.util.DevTools.writeVariables(DevTools.java:145)
               at com.sun.facelets.util.DevTools.debugHtml(DevTools.java:109)
               at com.sun.facelets.FaceletViewHandler.handleRenderException(FaceletViewHandler.java:692)
                  ...
          Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: ProcessManagerBean.taskInstance on: com.sap.agora.bpm.ProcessManagerBean with value: class org.jbpm.taskmgmt.exe.TaskInstance
               at org.jboss.seam.util.Reflections.set(Reflections.java:79)
               at org.jboss.seam.Component.setFieldValue(Component.java:1788)
               ... 64 more
          Caused by: java.lang.IllegalArgumentException: Can not set org.jboss.seam.bpm.TaskInstance field com.sap.agora.bpm.ProcessManagerBean.taskInstance to org.jbpm.taskmgmt.exe.TaskInstance
               at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
               at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
               at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
                  ...
               ... 65 more

          • 4. Re: Why SEAM sometimes cannot "set field value" while injecting a component
            Alex Kavo Novice

            I already tried it but I think the problem has something to do with the different packages of the TaskInstance. There is one called org.jboss.seam.bpm.TaskInstance and there is another one org.jboss.seam.bpm.TaskInstance. I have declared the TaskInstance from one package but SEAM tries to inject the TaskInstance from another package.

            • 5. Re: Why SEAM sometimes cannot "set field value" while injecting a component
              Guillaume Jeudy Master

              This looks like a problem very specific to jbpm/Seam integration and the way you are using it. Sorry I dont have experience in this area. I can only confirm that Seam tries to inject a


              org.jbpm.taskmgmt.exe.TaskInstance

              into a ref of

              org.jboss.seam.bpm.TaskInstance

              .


              Have you tried declaring your ref as

              org.jbpm.taskmgmt.exe.TaskInstance

              ?

              • 6. Re: Why SEAM sometimes cannot "set field value" while injecting a component
                Alex Kavo Novice

                Thanks for helping.
                I've already solved the problem the way Guillaume Jeudy told me.