2 Replies Latest reply on May 11, 2003 7:56 PM by mstoeckel

    multiple instances of JCA RA for multiple datasources

    mstoeckel

      I have problem connecting to multiple data sources using JCA RA.

      My Software configuration is as follows:
      JBoss:3.0.0
      JDO JCA RA:KODO 2.4.2
      DB:SQLServer2000
      JDBC Driver:MSSQLServer Service Pack 1

      I am trying to configure two JDO JCA connection factories each pointing to two separate databases.

      JDO-JCA-CF-A is configured(JDBC connection URL A) to point to DB-A
      JDO-JCA-CF-B is configured(JDBC connection URL B) to point to DB-B

      During container start up, JDO-JCA-CF-A is deployed before JDO-JCA-CF-B.
      When JDO-JCA-CF-A is used to access objects (DB tables) in DB-A, it throws an exception stating that the DB object does not exist(it exists in DB-A, but, not in DB-B).
      It seems that both JDO-JCA-CF-A and JDO-JCA-CF-B are both pointing to DB-B.

      I tried following combinations of configurations with no luck.

      1.
      Single kodo-service.xml with two mbean elements configured. (jboss.jca:service=LocalTxCM,name=KodoManagedConnectionPool, and jboss.jca:service=LocalTxCM,name=KodoManagedConnectionPoolAlt)
      Single kodo.rar

      2.
      Two separate *-service.xml files each with a single mbean element configured
      Single kodo.rar

      3.
      Single kodo-service.xml with two mbean elements configured. (jboss.jca:service=RARDeployment,name=KodoJDO, and jboss.jca:service=RARDeployment,name=KodoJDOAlt)
      Two separate *.rar files each with different <display-name> element. (KodoJDO and KodoJDOAlt)

      4.
      Two separate *-service.xml files each with a single mbean element configured
      Two separate *.rar files each with different <display-name> element. (KodoJDO and KodoJDOAlt)

      5.
      Same as 3 and 4, except this time with two different <eis-type> values (jdo, and jdoalt)


      All of the above configurations exhibit the same behavior, both connection factories pointing to the same database.

      Any help will be greatly appreciated.

      Regards,
      Michael

      P.S.

        • 1. Re: multiple instances of JCA RA for multiple datasources
          davidjencks

          First, please use a current jboss version. I recommend 3.2.1, the jca configuration is MUCH simpler than in 3.0.x

          How does the KODO adapter know which datasource to use?

          You should definitely use only one copy of the kodo .rar, with their ra.xml in it.

          The connection factory deployments can be in one or 2 files, it makes no difference.

          With 3.2.x, simply specifying different jndi names for the connection factories should work fine. For 3.0.x, you have to specify unique mbean names for all 3 mbeans for each connection factory.

          To progress further with this I really need to know how kodo learns which db to connect to.

          When you have something working, please contribute an example configuration.

          • 2. Re: multiple instances of JCA RA for multiple datasources
            mstoeckel

            David,

            It turns out that there is a bug in KODO's ManagedConnectionFactoryImpl.createConnectionFactory(ConnectionManager cm) method. So, it is returning a reference to a single instance of connectionFactory. I suspect that their code makes certain assumptions about the classloader in use (whatever that JBoss's UnifiedClassloader is doing, KODO folks did not account for, because KODO's RA works fine with Weblogic 7.0.1). KODO folks assured us that it will be fixed in their 2.5RC2 release.

            BTW, KODO RA knows which ds to connect to via their config parameters. So, each RA was configured with different ds. And, yes, I did configure all six MBeans with unique instance names.

            As for upgrading to 3.2.x, we will eventually do so, however, right now is not a good time for us. And, yes, I will post the example config file as soon as I can confirm that KODO 2.5RC2 functions correctly.

            Thanks a bunch for your help.

            Regards,
            Michael