3 Replies Latest reply on Jul 25, 2004 11:07 PM by j83

    CMR field cannot write to database????

    j83 Newbie

      Hi, i got the following exception when i trying to write data into the database where the field is a cmr field, i'm using mySQL database and Jboss server 4.0. Help needed!!!! Do anybody know why the following eception happen and how to solve the problem? thank you for willing to share ur experience and opinion with me!!!


      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: EJBException:; nested exception is:
      javax.ejb.EJBException: null; CausedByException is:
      null
      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 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)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Ljava.lang.Exception;)V(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall()V(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(Ljava.rmi.Remote;Ljava.lang.reflect.Method;[Ljava.lang.Object;J)Ljava.lang.Object;(UnicastRef.java:133)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(JRMPInvokerProxy.java:135)
      at org.jboss.invocation.InvokerInterceptor.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(InvokerInterceptor.java:96)
      at org.jboss.proxy.TransactionInterceptor.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(TransactionInterceptor.java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(SecurityInterceptor.java:45)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(HomeInterceptor.java:173)
      at org.jboss.proxy.ClientContainer.invoke(Ljava.lang.Object;Ljava.lang.reflect.Method;[Ljava.lang.Object;)Ljava.lang.Object;(ClientContainer.java:85)
      at $Proxy2.create(Ljava.lang.Integer;Lserver.user.ejb.Customer;)Lserver.core.event.ejb.WebSession;(Unknown Source)
      at server.core.event.domain.TestClient.main([Ljava.lang.String;)V(TestClient.java:55)
      Caused by: java.rmi.ServerException: EJBException:; nested exception is:
      javax.ejb.EJBException: null; CausedByException is:
      null
      at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:347)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:124)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:485)
      at org.jboss.ejb.Container.invoke(Container.java:909)
      at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:74)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:45)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:70)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:168)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:469)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
      at sun.reflect.GeneratedMethodAccessor121.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)
      Caused by: javax.ejb.EJBException: null; CausedByException is:
      null
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:807)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDBCCMRFieldBridge.java:616)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:137)
      at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
      at server.core.event.ejb.WebSessionBean$Proxy.setCustomer(:???)
      at server.core.event.ejb.WebSessionBean.ejbPostCreate(WebSessionBean.java:84)
      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:324)
      at org.jboss.ejb.plugins.CMPPersistenceManager.postCreateEntity(CMPPersistenceManager.java:240)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.postCreateEntity(CachedConnectionInterceptor.java:277)
      at org.jboss.ejb.EntityContainer.postCreateHome(EntityContainer.java:727)
      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:324)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:340)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1093)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:72)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:300)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:114)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:175)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:43)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:314)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      ... 22 more



      Thanks again!!!!

        • 1. Re: CMR field cannot write to database????
          Alexey Loubyansky Master

          What version exactly are you using? If you have the source, what is the revision of org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge (server module)?

          • 2. Re: CMR field cannot write to database????
            j83 Newbie

            Database: MySQL 4.0.20a
            JBoss server : 4.0DR3
            The revision: 1.76

            • 3. Re: CMR field cannot write to database????
              j83 Newbie

              hi, i am converting my cmr from weblogic to JBoss but i having problem when writing data to the database. the foreign key field will always be null when i run the application. i try to map the relation in the ejb-jar.xml and jbosscmp-jdbc.xml. I'm using MySQL 4.0.20a as database. but the relation seen not working. Anybody please help ......................

              Thank you...


              ejb-jar.xml
              .....

              <ejb-relation>

              <ejb-relation-name>PageEventBean-WebSessionBean</ejb-relation-name>
              <ejb-relationship-role>
              <ejb-relationship-role-name>PageEvent-Has-WebSession</ejb-relationship-role-name>
              Many
              <relationship-role-source>
              <ejb-name>PageEventBean</ejb-name>
              </relationship-role-source>
              <cmr-field>
              <cmr-field-name>webSession</cmr-field-name>
              </cmr-field>
              </ejb-relationship-role>
              <ejb-relationship-role>
              <ejb-relationship-role-name>WebSession-Has-PageEvent</ejb-relationship-role-name>
              One
              <relationship-role-source>
              <ejb-name>WebSessionBean</ejb-name>
              </relationship-role-source>
              <cmr-field>
              <cmr-field-name>pageEvents</cmr-field-name>
              <cmr-field-type>java.util.Collection</cmr-field-type>
              </cmr-field>
              </ejb-relationship-role>
              </ejb-relation>
              <ejb-relation>

              <ejb-relation-name>CustomerBean-WebSessionBean</ejb-relation-name>
              <ejb-relationship-role>
              <ejb-relationship-role-name>WebSession-Has-Customer</ejb-relationship-role-name>
              Many
              <relationship-role-source>
              <ejb-name>WebSessionBean</ejb-name>
              </relationship-role-source>
              <cmr-field>
              <cmr-field-name>customer</cmr-field-name>
              </cmr-field>
              </ejb-relationship-role>
              <ejb-relationship-role>
              <ejb-relationship-role-name>Customer-Has-WebSessions</ejb-relationship-role-name>
              One
              <relationship-role-source>
              <ejb-name>CustomerBean</ejb-name>
              </relationship-role-source>
              <cmr-field>
              <cmr-field-name>webSessions</cmr-field-name>
              <cmr-field-type>java.util.Collection</cmr-field-type>
              </cmr-field>
              </ejb-relationship-role>
              </ejb-relation>

              ......



              jbosscmp-jdbc.xml
              .....

              <ejb-relation>
              <ejb-relation-name>PageEventBean-WebSessionBean</ejb-relation-name>
              <foreign-key-mapping/>
              <ejb-relationship-role>
              <ejb-relationship-role-name>WebSession-Has-PageEvent</ejb-relationship-role-name>
              <key-fields>
              <key-field>
              <field-name>webSessionID</field-name>
              <column-name>webSessionID</column-name>
              </key-field>
              </key-fields>
              </ejb-relationship-role>
              <ejb-relationship-role>
              <ejb-relationship-role-name>PageEvent-Has-WebSession</ejb-relationship-role-name>
              <key-fields/>
              </ejb-relationship-role>
              </ejb-relation>
              <ejb-relation>
              <ejb-relation-name>CustomerBean-WebSessionBean</ejb-relation-name>
              <foreign-key-mapping/>
              <ejb-relationship-role>
              <ejb-relationship-role-name>WebSession-Has-Customer</ejb-relationship-role-name>
              <key-fields/>
              </ejb-relationship-role>
              <ejb-relationship-role>
              <ejb-relationship-role-name>Customer-Has-WebSessions</ejb-relationship-role-name>
              <key-fields>
              <key-field>
              <field-name>customerID</field-name>
              <column-name>customerID</column-name>
              </key-field>
              </key-fields>
              </ejb-relationship-role>
              </ejb-relation>


              ...

              Any help ?