1 Reply Latest reply on Jan 4, 2007 8:58 AM by beligum

    Seam injection fails

    beligum

      Hi all,

      Can someone tell me what I'm doing wrong here?
      I'm trying to inject the stateless RegisterAjaxAction class in my stateful RegisterAction class.
      Here's the code:

      @Stateful
      @Scope(CONVERSATION)
      @Name("register")
      public class RegisterAction implements IRegister
      {
       @In(create=true) @Out(required=false)
       private Person newUser;
       @In(create=true) @Out(required=false)
       private LoginEntity newLoginEntity;
      
       @In(create=true)
       private RegisterAjaxAction registerAjax;
      
       @In
       private EntityManager em;
      
       @Logger
       private Log log;
      
       //-----CONSTRUCTORS-----
       public RegisterAction()
       {
       }
      
       //GETTERS, SETTERS, etc
      


      and the injected class:

      @Stateless
      @Name("registerAjax")
      public class RegisterAjaxAction implements IRegisterAjax, Serializable
      {
       //-----CONSTANTS-----
       private static final long serialVersionUID = 2280962782361193463L;
      
       //-----VARIABLES-----
       @In(create=true)
       private Person newUser;
       @In(create=true)
       private LoginEntity newLoginEntity;
      
       private ResourceBundle msg = ResourceManager.getInstance().getGeneralMessages();
       private ResourceBundle regMsg = ResourceManager.getInstance().getRegisterMessages();
      
       @In private EntityManager em;
      
       //-----CONSTRUCTORS-----
       public RegisterAjaxAction()
       {
       }
      
       //STUFF...
      


      I get this error message:

      java.lang.IllegalArgumentException: could not set field value: register.registerAjax
       at org.jboss.seam.Component.setFieldValue(Component.java:1551)
       at org.jboss.seam.Component.injectFields(Component.java:1342)
       at org.jboss.seam.Component.inject(Component.java:1112)
       at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:48)
       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:18)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:23)
       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:18)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:51)
       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:18)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
       at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:49)
       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.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
       ... 91 more
      Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: RegisterAction.registerAjax on: com.acepostproduction.tumbolia.actions.RegisterAction with value: class org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$a78d35da
       at org.jboss.seam.util.Reflections.set(Reflections.java:75)
       at org.jboss.seam.Component.setFieldValue(Component.java:1547)
       ... 135 more
      Caused by: java.lang.IllegalArgumentException
       at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
       at java.lang.reflect.Field.set(Field.java:656)
       at org.jboss.seam.util.Reflections.set(Reflections.java:61)
       ... 136 more
      


      Thanks a lot,

      Bram