2 Replies Latest reply on May 12, 2002 8:40 PM by dviersel

    JBoss 3.0 RC2 - Multiple DataSources / Credentials problem

    dviersel

      Hi,

      I have a problem with the authetication of multiple datasources within a single security-realm and using a single database.

      I have set up JBoss 3.0 RC2 with two datasources:
      * "DefaultDS" which points to a MySql database with the "jbossdb" table
      "MyAppDS" which points to the same MySql DB with a table "myapp"

      Both datasources get registered during startup.
      I have specified the logon credentials for both datasources in login-config.xml (varying the order of appearance and the definition)

      I have created a simple CMP2.0 entity bean and specify its datasource in 'jbosscmp-jdbc.xml'. When I deployed it to the datasource which credentials are located before the other's in the login-config.xml, the bean gets deployed fine and in the correct database. When I try to deploy it to the datasource which credentials are located after that of the other datasource, things get messed up and JBoss tells me that:
      org.jboss.deployment.DeploymentException: error in create of EjbModule: njar:file:/C:/Java/jboss-3.0
      .0RC2/server/default/tmp/deploy/server/default/deploy/rcontrol.ear/77.rcontrol.ear^/nntp.jar; - nest
      ed throwable: (org.jboss.deployment.DeploymentException: Error while fixing table name; - nested thr
      owable: (java.sql.SQLException: ResourceException javax.resource.ResourceException: No matching cred
      entials in Subject!))

      Somehow, one datasource always misses its credentials. Either, the second credential in login-config.xml doesn't get picked up, or the first is overwritten by the second.

      Anyone any ideas?