1 Reply Latest reply on Dec 20, 2002 12:24 PM by juhalindfors

    Problem with CMR

    djambra

      Hi All,

      I have two entity beans "LeagueEJB" and "TeamEJB" related with a 1..* CMR.
      When I call the "LeagueEJB" findByPrimaryKey method from the session bean "RosterEJB" I get the following error:

      javax.ejb.EJBException: java.util.ArrayList
      at roster.RosterBean.getLeague(RosterBean.java:407)
      at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invoke(StatefulSessionContainer.java:817)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:266)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
      at org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:380)
      at org.jboss.ejb.Container.invoke(Container.java:712)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:381)
      at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)

      /************************************/

      The code that calls the method is:

      LocalLeague league = leagueHome.findByPrimaryKey(leagueId);

      /************************************/

      The declaration of the relationship is:


      <ejb-relation>
      <ejb-relation-name>League-Team</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>LeagueEJB</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>LeagueEJB</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>teams</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>TeamEJB</ejb-relationship-role-name>
      Many
      <cascade-delete />
      <relationship-role-source>
      <ejb-name>TeamEJB</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>league</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>


      /************************************/

      When I remove the relation, the things work fine...
      Does anybody knows what is happening?

      Thanks,

      Marcio