3 Replies Latest reply on Aug 27, 2002 6:20 PM by dsundstrom

    bidirectional one to may relation

    chintan

      I am trying to implement a bidirectional one to many relationship. one A has many Bs and vice versa. When I try to set the value of A in B's ejbPostCreate i get the exception below.

      Platform: Win2k, JBoss 3.0, CMP 2.0, Xdoclet 1.1.2, JDK1.4.0

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: null
      Embedded Exception
      $Proxy89; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      $Proxy89
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
      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 in.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
      60)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
      .java:701)
      at java.lang.Thread.run(Thread.java:536)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
      RemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
      223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Sour
      ce)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvo
      kerProxy.java:128)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
      a:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
      java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:7
      6)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy1.create(Unknown Source)
      at javatheater.client.MovieClient.main(MovieClient.java:31)
      Caused by: java.rmi.ServerException: null
      Embedded Exception
      $Proxy89; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      $Proxy89
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
      rceptor.java:119)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
      torCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.ja
      va:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercep
      tor.java:104)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
      09)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.Container.invoke(Container.java:726)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
      362)
      at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.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:4
      60)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
      .java:701)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: javax.ejb.EJBException: null
      Embedded Exception
      $Proxy89
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceV
      alue(JDBCCMRFieldBridge.java:630)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDB
      CCMRFieldBridge.java:563)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke
      (EntityBridgeInvocationHandler.java:125)
      at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
      at javatheater.ejb.implementation.ShowCMP$Proxy.setMovie()
      at javatheater.ejb.implementation.ShowBean.ejbPostCreate(ShowBean.java:4
      7)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.plugins.CMPPersistenceManager.postCreateEntity(CMPPersi
      stenceManager.java:284)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.post
      CreateEntity(CachedConnectionInterceptor.java:278)
      at org.jboss.ejb.EntityContainer.postCreateHome(EntityContainer.java:716
      )
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityConta
      iner.java:1174)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRel
      ationInterceptor.java:190)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntityS
      ynchronizationInterceptor.java:340)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
      ke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstance
      Interceptor.java:193)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
      tor.java:107)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCrea
      tionInterceptor.java:59)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
      rceptor.java:98)
      ... 19 more

        • 1. Re: bidirectional one to may relation
          dsundstrom

          First are you using 3.0.1? What is the exception printed on the server (in server.log)?

          • 2. Re: bidirectional one to may relation
            chintan

            Hi,
            I am using JBoss3.0.0 and there is no exception on the server side( in server.log) The logger level for server is TRACE.
            Also it seems to me that one of the methods that the Container tries to invoke using reflection is not present. This is my assumption. If I make the CMR fields persistent, by specifying the XDoclet tag @ejb:persistent-field, I stop getting this error, but these fields are saved in the table as JDBC object types. It may be that the CMR field that is a foreign key in one of the tables is being set by the container. The container tries to do this by calling a set method and fails since only the fields that are persistent have a set method.
            Thanks,

            • 3. Re: bidirectional one to may relation
              dsundstrom

              Upgrade to 3.0.1 or 3.0.2, and if it doesn't go away, you should atleast get a better exception message.