2 Replies Latest reply on Feb 12, 2004 11:29 AM by vng78

    XADataSource and auto-generating pk = bad combination?

    vng78 Newbie

      Hello, I've been using CMP and auto generate pk feature with MySQL for sometime now. Things worked well until recently when I tried to use XA tx for my application (MySQL + xapool). When I invoke create() on my EntityBean, I got "IllegalArgumentException: object is not an instance of declaring class". Other methods seem to work flawlessly though.

      The exception is really beyond me as I can't really see what went wrong:

      ------------------ start of log -------------------
      2004-01-31 17:37:26,309 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract psms.ejb.dispatch.DispatchLocal psms.ejb.dispatch.DispatchLocalHome.create(psms.ejb.dispatch.MutableDispatchIdentity) throws javax.ejb.CreateException, causedBy:
      java.lang.IllegalArgumentException: object is not an instance of declaring class
      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.cmp.jdbc.keygen.JDBCMySQLCreateCommand.executeInsert(JDBCMySQLCreateCommand.java:75)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:287)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:138)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:554)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:208)

      --------------- end of log --------------------------------

      Now, I really don't know if it's JBoss (incl. the keygen plugin) problem, MySQL or XAPool. However, reverting the tx to local-tx, everything works fine. Any ideas are greatly appreciated. Please let me know if you guys need more info. Please advise!

      Thank's!
      Vincent

        • 1. Re: XADataSource and auto-generating pk = bad combination?
          perseus Newbie

          Hy Vincent,

          I don't even know if it's possible to update two entity beans in a single transaction (2-phase commit) with JBoss and MySQL.
          I saw a 60 euros problem ticket at www.infutura.com that deals with that question and there is currently no result.

          What version of JBoss and mysql do you use?

          Regards,
          Jack

          • 2. Re: XADataSource and auto-generating pk = bad combination?
            vng78 Newbie

            Sorry for the late reply - I thought nobody would ever reply.
            MySQL v4.0
            JBoss v3.2.3
            XAPool v1.3.1 (hope it's correct - the latest anyway)

            It only happened with create() and coincidentally (or not), I use the auto-generate-pk stuff to generate the PK. The reason I'm trying XA is I want to ensure that updates to EJB and sending of JMS message happen in one transaction so if the EJB fails the JMS message shouldn't be sent at all. I've been searching for a while and still nothing... Guess I'll try it out with Oracle when I have time. Any more ideas?

            thanks
            vincent