Question

Running into an issue where our datasources for two different DBMS (MS-SQLServer and Informix) are not picking up the security-domain configuration in the login-config.xml file.

Our datasources look like this:

    <datasources>
      <local-tx-datasource>
        <jndi-name>ourTX</jndi-name>
        <connection-url>jdbc:informix-sqli://our.server.com:1526/wlms:informixserver=ol_db</connection-url>
        <driver-class>com.informix.jdbc.IfxDriver</driver-class>
        <security-domain>ourDS</security-domain>
        <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
        <metadata>
           <type-mapping>InformixDB</type-mapping>
        </metadata>
        <min-pool-size>5</min-pool-size>
        <max-pool-size>50</max-pool-size>
        <prefill>yes</prefill>
        <prepared-statement-cache-size>10</prepared-statement-cache-size>
        <idle-timeout-minutes>5</idle-timeout-minutes>
        <new-connection-sql>set lock mode to wait 4;set isolation to cursor stability;</new-connection-sql>
        <check-valid-connection-sql>SELECT count(*) FROM dummy;</check-valid-connection-sql>
      </local-tx-datasource>
    </datasources>

And our login-config.xml has the following entry:

  <application-policy name="ourDS">
    <authentication>
      <login-module code="org.jboss.resource.security.SecureIdentityLoginModule" flag="required">
         <module-option name="userName">user</module-option>
         <module-option name="password">-4e5f8b6c4217c342c03b57ed16d31678</module-option>
         <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=ourTX</module-option>
      </login-module>
    </authentication>
  </application-policy>

However, once the JBoss server is deployed, we get an error like this for Informix:

13:23:13,521 WARN  [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Incorrect password or user com.informix.asf.IfxASFRemoteException: user@my.computer.com is not known on the database server.)

And for MS-SQLServer we get a similar error to Informix which looks like:

13:25:23,053 WARN  [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.)

Now if, we comment out the security-domain element in the *-ds.xml file and replace it with a simple user name and a clear text password, both datasource work with both database engines. We're using the 'all' server configuration in JBoss. We've made sure that login-config.xml is getting loaded on start-up. And the hqsqldb-ds.xml using the security-domain element works. But using our added application-policy to the login-config.xml, it seems that the datasource does not get the values when establishing a new connection.

Any ideas what we're doing wrong? Have we missed something?

Was it helpful?

Solution

We were testing the validity of the datasource through the admin-console. Because of where we were testing the database, this is bug in the JBoss EAP 5.0.0.GA version. While not confirmed, may also be a but bug in the admin-console for 5.0.1.GA and maybe 5.0.2.GA.

Everything above was actually working.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top