1 Reply Latest reply on Jul 16, 2007 6:46 AM by Jonathan Halliday

    Jboss4.2 - Mysql5

    Yasir Siraj Newbie


      This is a repost of "4.0.5 to 4.2.0 upgrade and JBossTS"... I'm kinda desperate on getting this resolved. My issue is exactly the same as reported by helgaw.. so i've copied his/her stuff to save time...
      ...............................................................................
      Currently I am getting

      java.lang.IllegalArgumentException: object is not an instance of declaring class

      while creating entity beans (ejb 2). Reads, updates and deletes seem to work fine.

      I have not modifed the jbossjta-properties.xml file but I have moved all my -ds.xml files from

      Code:

      <local-tx-datasource>



      to

      Code:

      <xa-datasource>




      I would prefer that rather than sticking with the local transactions as that is more of a long term solution.

      My ds file looks like this

      Code:


      <xa-datasource>
      <jndi-name>SystemDS</jndi-name>
      <xa-datasource-property name="URL">jdbc:mysql://myserver/mydb</xa-datasource-property>
      <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
      <user-name>myusername</user-name>
      mypassword

      <type-mapping>mySQL</type-mapping>

      <min-pool-size>5</min-pool-size>
      <max-pool-size>20</max-pool-size>

      <!-- Don't allow connections to hang out idle too long,
      never longer than what wait_timeout is set to on the
      server...A few minutes is usually okay here,
      it depends on your application
      and how much spikey load it will see -->

      <idle-timeout-minutes>5</idle-timeout-minutes>
      <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

      <!-- trying to get XA to work -->
      <track-connection-by-tx>true</track-connection-by-tx>
      <no-tx-separate-pools/>

      <!-- If you're using Connector/J 3.1.8 or newer, you can use
      our implementation of these to increase the robustness
      of the connection pool. -->
      <exception-sorter-class-name>
      com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter
      </exception-sorter-class-name>
      <valid-connection-checker-class-name>
      com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker
      </valid-connection-checker-class-name>
      </xa-datasource>





      and I am using mysql-connector 5.0.3 (also tried 5.0.6)

      There is no example of a mysql -ds file using xa provided in the docs\examples\jca directories.

      Here is a log of what happens:

      Code:

      2007-06-12 13:19:05,637 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MobileStyleSheet
      s] Executing SQL: SELECT pageid, device, instance, stylesheet FROM mobilestylesheets WHERE (id=?)
      2007-06-12 13:19:05,667 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MobileStyleSheet
      s] Executing SQL: SELECT pageid, device, instance, stylesheet FROM mobilestylesheets WHERE (id=?)
      2007-06-12 13:19:05,697 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MobilePages] Exe
      cuting SQL: SELECT name, type, reference, owner, url, variant, created, pagetype, faceid FROM mobile
      pages WHERE (id=?)
      2007-06-12 13:19:05,737 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MobilePages] Exe
      cuting SQL: SELECT name, type, reference, owner, url, variant, created, pagetype, faceid FROM mobile
      pages WHERE (id=?)
      2007-06-12 13:19:05,777 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand.Visit] E
      xecuting SQL: INSERT INTO visits (ownerfaceid, page, pagetype, visitorfaceid, visitorip, visitorsess
      ion, timestamp, date, userAgent) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
      2007-06-12 13:19:05,927 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalExcep
      tion in method: public abstract net.hexia.cia.oem.track.entity.Visit net.hexia.cia.oem.track.entity.
      VisitHome.create(net.hexia.cia.oem.track.entity.VisitVO) 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:585)
      at org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand.executeInsert(JDBCMySQLCreateComman
      d.java:116)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand
      .java:321)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:
      151)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:587)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:237)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionIn
      terceptor.java:225)
      at org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:625)
      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:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1126)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationIntercept
      or.java:203)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInte
      rceptor.java:189)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:136)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:76)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:45)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.jav
      a:107)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:521)
      at org.jboss.ejb.Container.invoke(Container.java:981)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:359)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:133)
      at $Proxy565.create(Unknown Source)