3 Replies Latest reply on Sep 18, 2002 12:21 AM by davidjencks

    Using 2 databases in same jboss 3.01 deployment

    akeidel

      I am setting up jboss 3.01. I want to use two separate databases in the same deployment. To do this, I'm trying to put two xml files for the database service in the server/default/deploy directory.

      The problem I'm getting seems to be happenning because jboss is trying to use the same connection pool for the two separate databases. I need to configure it to use separate connection pools. But I don't know what to change in the config xml files to do this.

      Below I've pasted (1) the xml config files I'm using and (2) the error message jboss is throwing. Any help is much appreciated!


      1. Config files I'm using were going to be attached, but the site wasn't working when I tried that. Anyway, they're almost the same. One is posted below. Only the names "PostgresDS" and "PostgresDB" are changed in the other file, which I didn't bother to paste.


      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->



      <!-- ==================================================================== -->
      <!-- New ConnectionManager setup for default hsql dbs -->
      <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
      <!-- ==================================================================== -->




      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->


      PostgresDS


      <config-property name="ConnectionURL" type="java.lang.String">************</config-property>
      <config-property name="DriverClass" type="java.lang.String">org.postgresql.Driver</config-property>
      <config-property name="UserName" type="java.lang.String">************</config-property>
      <config-property name="Password" type="java.lang.String">************</config-property>



      <!--Below here are advanced properties -->
      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper

      jboss:service=Hypersonic



      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->


      0
      5
      5000
      15
      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByContainer


      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

      java:/TransactionManager

      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer




      <!-- Moved to end to test anonymous depends -->
      <!--

      1476
      true
      default
      false

      -->





      2. Error from jboss:

      23:14:41,123 WARN [LocalTxConnectionManager] reconnecting a connection handle that still has a managedConnection! org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@6c6bb1 org.jboss.resource.adapter.jdbc.local.LocalConnection@12425a
      23:14:41,123 ERROR [GlobalTxEntityMap] Store failed on entity:
      java.lang.IllegalArgumentException: reconnect(ConnectionRecord cr) called with a non null ManagedConnection that was not killed!
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnect(BaseConnectionManager2.java:582)
      at org.jboss.resource.connectionmanager.CachedConnectionManager.reconnect(CachedConnectionManager.java:339)
      at org.jboss.resource.connectionmanager.CachedConnectionManager.pushMetaAwareObject(CachedConnectionManager.java:137)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:385)
      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:705)
      at org.jboss.ejb.GlobalTxEntityMap.syncEntities(GlobalTxEntityMap.java:99)
      at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:172)
      at org.jboss.ejb.EntityContainer.find(EntityContainer.java:656)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1116)

        • 1. Re: Using 2 databases in same jboss 3.01 deployment
          davidjencks

          Please use 3.0.2 or 3.2, start with the postgres example file from the version you use, put both configurations in one file, make sure all the object names are unique, and see if there is still a problem.

          I realize that it seems silly to post 2 nearly identical files, but without that I can't verify that all the object names in your config are unique and rule out such simple problems.

          • 2. Re: Using 2 databases in same jboss 3.01 deployment
            seanx

            You don't need lines to do with "jboss:service=Hypersonic". You can remove them. These line already exists in hypersonic service file.

            Another thing, do you need to use two services files? Can you just repeat the jboss.jca:service=LocalTxDS,name=sybasedbDS for the second database?

            Do you have any document on db-services.xml? it is too clumsy to define a Datasource.

            • 3. Re: Using 2 databases in same jboss 3.01 deployment
              davidjencks

              You can use one service file for any number of datasources or other mbeans. You do have to make sure all object names are globally unique.

              I agree the ds config is ridiculous in 3.0.x Please try the simplified *-ds.xml files in 3.2 and 4.