1 2 Previous Next 20 Replies Latest reply on Mar 19, 2002 8:42 AM by Jurrien

    possible bug with CMP and compound keys

    Mac Rinehart Newbie

      Hi,

      I'm using the JBoss-3.0.0beta_tomcat4.0.2 build with the default CMP settings and hypersonic database. I'm letting the container create my entities. I'm experiencing problems with CMP on entities that have compound primary keys. My primary key is has two fields - long clientId and long createDate. The ejbCreate method works great and the records are inserted. When I invoke a CMR setter in the ejbPostCreate method the invocation fails with no exception. Rather than reporting an exception the CMR setter assigns values clientId = 0 and createDate = 0. The source for my CMR setter invocation is excerpted below:

      public void ejbPostCreate(AccountHolderKey key) throws CreateException {
      try {
      this.setAccountHolder(ejbSelectAccountHolder(key.getClientId(), key.getCreateDate()));
      // The previous line does not throw an exception, but inserts invalid relationship attributes into the accountHolder CMR field.
      }
      catch (FinderException e) {
      throw new CreateException();
      }
      }

      When I invoke a CMR field getter I get in internal server error. I also get internal server errors when trying to invoke a business method on the entities with compound primary keys. The exceptions from business methods and CMR getters both have the same root cause: java.lang.IllegalArgumentException - Object is not an instance of declaring class. These exceptions are thrown when JBoss attempts to load the entities with compound primary keys. I've successfully invoked CMR setters, getters and business methods on entities with simple primary keys, so I think this issue is isolated to compound primary keys.

      This issue appears to be a bug, but I wanted to perception check first and ensure that I don't have some configuration problem. As I said previously, I have relied on the default <jbosscmp-jdbc> settings, and have not included any custom database mapping or configuration for my application.

      The stack trace is shown below (I'd attach the server.log but the attach files page isn't allowing me to post messages):

      2002-03-06 09:01:45,172 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException, causedBy:
      java.lang.IllegalArgumentException: object is not an instance of declaring class
      at java.lang.reflect.Field.get(Native Method)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.getPrimaryKeyValue(JDBCAbstractCMPFieldBridge.java:126)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setForeignKey(JDBCCMRFieldBridge.java:911)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.loadInstanceResults(JDBCCMRFieldBridge.java:995)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:138)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:62)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:409)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:380)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:275)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:189)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:108)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:475)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.invokeRemoveRelation(JDBCCMRFieldBridge.java:707)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.createRelationLinks(JDBCCMRFieldBridge.java:601)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:573)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDBCCMRFieldBridge.java:511)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:115)
      at org.jboss.proxy.compiler.ProxyCompiler$Runtime.invoke(ProxyCompiler.java:89)
      at com.sextanttech.entities.implementations.AddressBean$Proxy.setAccountHolder(Unknown Source)
      at com.sextanttech.entities.implementations.AddressBean.ejbPostCreate(AddressBean.java:46)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:256)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:690)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1051)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:222)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:136)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:80)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:469)
      at org.jboss.ejb.Container.invoke(Container.java:682)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:995)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:364)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      at sun.rmi.transport.Transport$1.run(Transport.java:152)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      at java.lang.Thread.run(Thread.java:484)
      2002-03-06 09:01:45,182 ERROR [org.jboss.invocation.jrmp.server.JRMPInvoker] operation failed
      java.rmi.ServerException: Error in removeRelation
      Embedded Exception
      Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class; nested exception is:
      javax.ejb.EJBException: Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class; nested exception is:
      javax.ejb.EJBException: Error in removeRelation
      Embedded Exception
      Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class; nested exception is:
      javax.ejb.EJBException: Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class
      javax.ejb.EJBException: Error in removeRelation
      Embedded Exception
      Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class; nested exception is:
      javax.ejb.EJBException: Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.invokeRemoveRelation(JDBCCMRFieldBridge.java:717)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.createRelationLinks(JDBCCMRFieldBridge.java:601)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:573)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDBCCMRFieldBridge.java:511)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:115)
      at org.jboss.proxy.compiler.ProxyCompiler$Runtime.invoke(ProxyCompiler.java:89)
      at com.sextanttech.entities.implementations.AddressBean$Proxy.setAccountHolder(Unknown Source)
      at com.sextanttech.entities.implementations.AddressBean.ejbPostCreate(AddressBean.java:46)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:256)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:690)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1051)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:222)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:136)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:80)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:469)
      at org.jboss.ejb.Container.invoke(Container.java:682)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:995)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:364)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      at sun.rmi.transport.Transport$1.run(Transport.java:152)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      at java.lang.Thread.run(Thread.java:484)
      javax.transaction.TransactionRolledbackException: Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class; nested exception is:
      javax.ejb.EJBException: Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class
      javax.ejb.EJBException: Internal error getting primary key field member createDate
      Embedded Exception
      object is not an instance of declaring class
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.getPrimaryKeyValue(JDBCAbstractCMPFieldBridge.java:133)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setForeignKey(JDBCCMRFieldBridge.java:911)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.loadInstanceResults(JDBCCMRFieldBridge.java:995)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:138)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:62)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:409)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:380)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:275)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:189)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:108)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:475)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.invokeRemoveRelation(JDBCCMRFieldBridge.java:707)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.createRelationLinks(JDBCCMRFieldBridge.java:601)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:573)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDBCCMRFieldBridge.java:511)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:115)
      at org.jboss.proxy.compiler.ProxyCompiler$Runtime.invoke(ProxyCompiler.java:89)
      at com.sextanttech.entities.implementations.AddressBean$Proxy.setAccountHolder(Unknown Source)
      at com.sextanttech.entities.implementations.AddressBean.ejbPostCreate(AddressBean.java:46)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:256)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:690)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1051)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:222)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:136)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:80)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:469)
      at org.jboss.ejb.Container.invoke(Container.java:682)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:995)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:364)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      at sun.rmi.transport.Transport$1.run(Transport.java:152)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      at java.lang.Thread.run(Thread.java:484)
      java.lang.IllegalArgumentException: object is not an instance of declaring class
      at java.lang.reflect.Field.get(Native Method)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.getPrimaryKeyValue(JDBCAbstractCMPFieldBridge.java:126)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setForeignKey(JDBCCMRFieldBridge.java:911)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.loadInstanceResults(JDBCCMRFieldBridge.java:995)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:138)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:62)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:409)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:380)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:275)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:189)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:108)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:475)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.invokeRemoveRelation(JDBCCMRFieldBridge.java:707)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.createRelationLinks(JDBCCMRFieldBridge.java:601)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:573)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JDBCCMRFieldBridge.java:511)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:115)
      at org.jboss.proxy.compiler.ProxyCompiler$Runtime.invoke(ProxyCompiler.java:89)
      at com.sextanttech.entities.implementations.AddressBean$Proxy.setAccountHolder(Unknown Source)
      at com.sextanttech.entities.implementations.AddressBean.ejbPostCreate(AddressBean.java:46)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:256)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:690)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1051)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:222)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:136)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:80)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:469)
      at org.jboss.ejb.Container.invoke(Container.java:682)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:995)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:364)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      at sun.rmi.transport.Transport$1.run(Transport.java:152)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      at java.lang.Thread.run(Thread.java:484)

        • 1. Re: possible bug with CMP and compound keys
          Dain Sundstrom Master

          I haven't read your entire post, but it looks like your are trying to use a cmr field as a primary key field. This does not work under any conditions. Don't try it.

          This kind of mapping is not allowed by the EJB spec but JBossCMP will eventually support it anyway.

          If this is not what you are doing, respond and I will read the entire post.

          • 2. Re: possible bug with CMP and compound keys
            Mac Rinehart Newbie

            Using a CMR field for a primary key would be a problem, but it is not what I'm trying to do. I'll attach the default.script file for Hypersonic, which should give you an idea of the structure and data.

            • 3. Re: possible bug with CMP and compound keys
              Mac Rinehart Newbie

              Here's another interesting twist:

              given the following primary keys:
              account table has a pk(long accountId, long createDate)
              accountHolder has pk(long clientId, long createDate)
              address has a pk(java.lang.Long addressId)

              my database build script checks for the existence of accounts using a account.findByAccountHolder(long clientId, long createDate) method. That fails, resulting in the creation of new accounts every time the script is run. The issue has the same root cause, the CMR setter invocation is not working. Note that the in the relationship between account and accountHolder, both entities have compound primary keys.

              The interesting twist is that the address.findByAccountHolder(long, long) does work. In that case the address table has a simple primary key. The relationship is bidirectional, and the accountHolder's data should be in the address table, but it is not. However, the address data is in the accountHolder table, which is sufficient to initialize the relationship and allow the address to find it associated accountHolder even though the persistence engine is not storing the accountHolder CMR data in the address table.

              - Mac

              • 4. Re: possible bug with CMP and compound keys
                Dain Sundstrom Master

                This looks like a bug that David already fixed in cvs head. Can you test your code with the cvs build? If not, can you develop a simple test case and post bug report at sourceforge?

                • 5. Re: possible bug with CMP and compound keys
                  Mac Rinehart Newbie

                  I'd like to test it. Trouble is I've not used CVS before so I'm kind of a dummy when it comes to getting the proper modules and building them. Is there a brief overview of which modules are needed? Thanks

                  • 6. Re: possible bug with CMP and compound keys
                    David Jencks Master

                    I think there are checkout and build instructions on the website. Briefly, checkout jboss-all, go to build, run build.sh.

                    • 7. Re: possible bug with CMP and compound keys
                      Thomas Phan Newbie

                      FYI, I got the same problem (using JBoss 3 Beta, or prior to that). As long as I changed to use java.lang.Integer to replace my PK class (a compound key with a int value), the problem seems fine, so I didn't report that here. I guess JBoss doesn't dereference the PK class to get the "related-pk-field", so that the problem was there.

                      • 8. Re: possible bug with CMP and compound keys
                        Mac Rinehart Newbie

                        I've been working on testing this since the 7th. But the bugs in my application change with every CVS checkout, and I haven't been able to get as far along as I was when I orginally posted this thread. Latest issue:

                        http://main.jboss.org/thread.jsp?forum=46&thread=10529

                        I'm trying to work though this other issue right now, any insights would be greatly appriciated. :)


                        - Mac

                        • 9. Re: possible bug with CMP and compound keys
                          Marius Kotsbak Newbie

                          Maybe this stacktrace ( from an old jboss 3.x-alpha) could help. I got this problem after converting from Long-primary key to GroupPK with just a Long-field (groupID):

                          2002-03-11 20:42:14,142 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException, causedBy:
                          java.lang.IllegalArgumentException: object is not an instance of declaring class
                          at java.lang.reflect.Field.get(Native Method)
                          at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.getPrimaryKeyValue(JDBCAbstractCMPFieldBridge.java:108)
                          at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setForeignKey(JDBCCMRFieldBridge.java:896)
                          at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.loadPreloadedValue(JDBCCMRFieldBridge.java:871)
                          at org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.load(ReadAheadCache.java:243)
                          at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:76)
                          at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:62)
                          at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:411)
                          at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:380)
                          at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:274)
                          at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:189)
                          at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:108)
                          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
                          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:158)
                          at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:64)
                          at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
                          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
                          at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:435)
                          at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:346)
                          at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker$EntityProxy.invoke(BaseLocalContainerInvoker.java:475)
                          at $Proxy150.getAccount(Unknown Source)
                          at no.polardesign.boostcom.registrar.RegistrarBean.ejbCreate(RegistrarBean.java:507)
                          at java.lang.reflect.Method.invoke(Native Method)
                          at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.createSession(StatefulSessionFilePersistenceManager.java:159)
                          at org.jboss.ejb.StatefulSessionContainer.createHome(StatefulSessionContainer.java:413)
                          at java.lang.reflect.Method.invoke(Native Method)
                          at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invokeHome(StatefulSessionContainer.java:707)
                          at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
                          at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invokeHome(StatefulSessionInstanceInterceptor.java:125)
                          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
                          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:158)
                          at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:55)
                          at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
                          at org.jboss.ejb.StatefulSessionContainer.invokeHome(StatefulSessionContainer.java:340)
                          at org.jboss.ejb.Container.invoke(Container.java:658)
                          at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
                          at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
                          at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:113)
                          at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:149)
                          at org.jboss.proxy.ejb.GenericProxy.invoke(GenericProxy.java:182)
                          at org.jboss.proxy.ejb.HomeProxy.invoke(HomeProxy.java:194)
                          at $Proxy74.create(Unknown Source)
                          at no.boostcom.web.connect.servletProxy.PopUpServletProxy.getRegistrar(PopUpServletProxy.java:277)
                          at no.boostcom.web.connect.servletProxy.PopUpServletProxy.service(PopUpServletProxy.java:34)
                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:327)
                          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:546)
                          at org.mortbay.http.HttpContext.handle(HttpContext.java:1269)
                          at org.mortbay.http.HttpContext.handle(HttpContext.java:1223)
                          at org.mortbay.http.HttpServer.service(HttpServer.java:725)
                          at org.mortbay.http.HttpConnection.service(HttpConnection.java:748)
                          at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:921)
                          at org.mortbay.http.HttpConnection.handle(HttpConnection.java:763)
                          at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:138)
                          at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
                          at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
                          at java.lang.Thread.run(Thread.java:498)
                          2002-03-11 20:42:14,315 DEBUG [org.jboss.tm.TxCapsule] setRollbackOnly(): Entered, tx=XidImpl [FormatId=257, GlobalId=marius//2, BranchQual=] status=STATUS_MARKED_ROLLBACK
                          2002-03-11 20:42:14,315 DEBUG [org.jboss.tm.TxCapsule] rollback(): Entered, tx=XidImpl [FormatId=257, GlobalId=marius//2, BranchQual=] status=STATUS_MARKED_ROLLBACK
                          2002-03-11 20:42:14,477 DEBUG [org.jboss.tm.TxManager] suspended tx: TransactionImpl:XidImpl [FormatId=257, GlobalId=marius//2, BranchQual=]
                          2002-03-11 20:42:14,477 ERROR [org.jboss.ejb.StatefulSessionContainer] invoke returned an exception
                          java.rmi.ServerException: Internal error getting primary key field member groupID
                          Embedded Exception

                          If this is a bug, is it reported as a bug on sourceforge?

                          Marius

                          • 10. Re: possible bug with CMP and compound keys
                            Marius Kotsbak Newbie

                            BTW i got a similar stacktrace in todays jboss 3.x.

                            • 11. Re: possible bug with CMP and compound keys
                              Mac Rinehart Newbie

                              The attached file can be used to test relationships on entity objects with compound primary keys. Currently i generates the error discussed in this thread. The error is generated on the latest CVS update. The build I used has a 1.1 tag on the org.jboss.proxy.compiler package as a workaround for an unrelated exception.

                              Source code is included. I wanted to set up a proper JBoss test case, but was unable due to time constraints and lack of familiarity with the implementing test cases. Hopefully someone will find what is provided to be useful, and can complete the work on the test cases. That should be a pretty simple task, given that the client program (com.sextanttech.client.Client) contains all the source code necessary to setup and execute a variety of tests to System.out.

                              If you have any questions, please contact me. If someone notices any problems with the code, please let me know.

                              Thanks, Mac

                              • 12. Re: possible bug with CMP and compound keys
                                Dain Sundstrom Master

                                I'll look at this, but you need to post this in a bug report at sourceforge.

                                http://sourceforge.net/tracker/?atid=376685&group_id=22866&func=browse

                                • 13. Re: possible bug with CMP and compound keys
                                  Mac Rinehart Newbie

                                  done. I finished the TestCase and posted that up there as well. - Mac

                                  • 14. Re: possible bug with CMP and compound keys
                                    Marius Kotsbak Newbie

                                    When do you think this will be resolved? I think it is an important bug cause it disables the use of primary key objects as I see it.

                                    I tried to debug it, but could not get eclipse to find the jboss-sourcecode, just my bean-code (with breakpoint in). What do you developers use to debug jboss?

                                    Marius

                                    1 2 Previous Next