1 2 Previous Next 15 Replies Latest reply on Nov 15, 2006 1:46 PM by germit

    Exception when using @EJB (or JNDI to inject a session bean)

    antispart

      I'm in the process of porting (well, re-creating really) a web app with Seam. It's been working great except that I get an Exception when using @EJB to inject another session bean.

      Until now, all my session beans had worked independantly of each other so I hadn't noticed this.

      I have a session bean:

      @Stateful
      @Name("showMatrix")
      @Scope(ScopeType.SESSION)
      public class PlayerActionBean implements PlayerActionLocal {
      @In(create=true)
      private EntityManager entityManagerSeam;

      @In(required=false)
      PlayerPlay selectedPlayerPlay;

      @Out(required=false)
      List someList;

      @EJB
      private SomeBeanLocal someBean;

      @Factory("someList")
      public void create() {
      // use someBean here
      }
      ...
      }

      This worked fine until I tried injecting a session bean "someBean" with @EJB.

      Any ideas what could be going wrong?

      Stack trace:

      javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: could not set field value: showMatrix.selectedPlayerPlay
      at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
      at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:201)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

      [ ... ]

      at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
      at $Proxy173.replay(Unknown Source)
      at com.example.web.PlayerActionBean.createMatrix(PlayerActionBean.java:55)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      [ ... ]

      16:26:41,666 ERROR [STDERR] calProxy.java:98)
      at $Proxy198.createMatrix(Unknown Source)
      at com.example.web.PlayerActionLocal$$FastClassByCGLIB$$609ecd47.invoke()
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)

      [ ... ]

      Caused by: java.lang.IllegalArgumentException: could not set field value: showMatrix.selectedPlayerPlay
      at org.jboss.seam.Component.setFieldValue(Component.java:1508)
      at org.jboss.seam.Component.injectFields(Component.java:1299)

      [ ... ]

      16:26:42,151 ERROR [STDERR] tionContext.java:64)
      at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:79)
      at sun.reflect.GeneratedMethodAccessor151.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      [ ... ]

      Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: PlayerActionBean.selectedPlayerPlay on: com.example.SlotsPlayerBean with value: class com.example.model.PlayerPlay
      at org.jboss.seam.util.Reflections.set(Reflections.java:75)
      at org.jboss.seam.Component.setFieldValue(Component.java:1504)
      .. 235 more
      Caused by: java.lang.IllegalArgumentException
      at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
      at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:57)
      at java.lang.reflect.Field.set(Field.java:656)
      at org.jboss.seam.util.Reflections.set(Reflections.java:61)

        1 2 Previous Next