Uploaded image for project: 'HAL'
  1. HAL
  2. HAL-1996

HAL - duplicate XA property databaseName is generated by the DB wizard

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • Hide

      1. install JBoss EAP 8.0.3

      $ unzip jboss-eap-8.0.0.zip
      $ unzip jboss-eap-8.0.3-maven-repository.zip
      $ cd jboss-eap-8.0
      $ bin/jboss-eap-installation-manager.sh update perform --offline --repositories=file:/home/test/jboss-eap-8.0.3.GA-maven-repository/maven-repository/ --yes
      

      2. create org.postgresql driver module

      $ mkdir -p modules/org/postgresql/main
      $ cp postgresql-42.7.4.jar modules/org/postgresql/main/
      $ cat <<EOF > modules/org/postgresql/main/module.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.9" name="org.postgresql">
          <resources>
              <resource-root path="postgresql-42.7.4.jar"/>
          </resources>
          <dependencies>
              <module name="wildflyee.api"/>
              <module name="sun.jdk"/>
              <module name="ibm.jdk"/>
              <module name="javax.api"/>
          </dependencies>
      </module>
      EOF
      

      3. add driver to standalone.xml

      $ diff -u standalone.xml.original standalone.xml
      --- standalone.xml.original	2024-10-01 11:39:48.414416750 +0900
      +++ standalone.xml	2024-10-01 14:22:28.581022147 +0900
      @@ -137,6 +137,9 @@
                           <driver name="h2" module="com.h2database.h2">
                               <xa-datasource-class>;org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                           </driver>
      +                    <driver name="postgresql" module="org.postgresql">
      +                        <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
      +                    </driver>
                       </drivers>
                   </datasources>
               </subsystem>
      

      4. add a management user to access web console

      $ bin/add-user.sh -u admin -p StrongPass1!
      

      5. start JBoss EAP 8.0.3

      $ bin/standalone.sh 
      

      6. access http://localhost:9990/ with brower, then open a Add XA Datasource wizard
      [Configuration] - [Subsystems] - [Datasource & Drivers] - [Datasources] - click + button - Add XA Datasource wizard
      7. Put following parameters to the wizard
      Choose Template: PostgreSQL
      Attributes:
      Name: PostgresXADS
      JNDI Name: java:/PostgresXADS
      JDBC Driver:
      Driver Name: postgresql
      Driver XA Datasource Class: org.postgresql.xa.PGXADataSource
      XA Properties:
      serverName=127.0.0.1 portNumber=5432 databaseName=postgres
      Connection:
      User Name: postgres
      Password: postgres

      8. click Test connection, but it will fail. Because XA propery <DatabaseName> added by the wizard by default even if databaseName=postgres is set in the wizard:

      <xa-datasource jndi-name="java:/PostgresXADS" pool-name="PostgresXADS">
          <xa-datasource-property name="&lt;DatabaseName&gt;">  <<==
              postgresdb                                        <<==
          </xa-datasource-property>                             <<==
          <xa-datasource-property name="serverName">
              127.0.0.1
          </xa-datasource-property>
          <xa-datasource-property name="portNumber">
              5432
          </xa-datasource-property>
          <xa-datasource-property name="databaseName">
              postgres
          </xa-datasource-property>
          <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
          <driver>postgresql</driver>
          <security>
              <user-name>postgres</user-name>
              <password>postgres</password>
          </security>
          <validation>
              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
              <validate-on-match>true</validate-on-match>
              <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
          </validation>
      </xa-datasource>
      
      Show
      1. install JBoss EAP 8.0.3 $ unzip jboss-eap-8.0.0.zip $ unzip jboss-eap-8.0.3-maven-repository.zip $ cd jboss-eap-8.0 $ bin/jboss-eap-installation-manager.sh update perform --offline --repositories=file:/home/test/jboss-eap-8.0.3.GA-maven-repository/maven-repository/ --yes 2. create org.postgresql driver module $ mkdir -p modules/org/postgresql/main $ cp postgresql-42.7.4.jar modules/org/postgresql/main/ $ cat <<EOF > modules/org/postgresql/main/module.xml <?xml version= "1.0" encoding= "UTF-8" ?> <module xmlns= "urn:jboss:module:1.9" name= "org.postgresql" > <resources> <resource-root path= "postgresql-42.7.4.jar" /> </resources> <dependencies> <module name= "wildflyee.api" /> <module name= "sun.jdk" /> <module name= "ibm.jdk" /> <module name= "javax.api" /> </dependencies> </module> EOF 3. add driver to standalone.xml $ diff -u standalone.xml.original standalone.xml --- standalone.xml.original 2024-10-01 11:39:48.414416750 +0900 +++ standalone.xml 2024-10-01 14:22:28.581022147 +0900 @@ -137,6 +137,9 @@ <driver name= "h2" module= "com.h2database.h2" > <xa-datasource-class> ;org.h2.jdbcx.JdbcDataSource </xa-datasource-class> </driver> + <driver name= "postgresql" module= "org.postgresql" > + <xa-datasource-class> org.postgresql.xa.PGXADataSource </xa-datasource-class> + </driver> </drivers> </datasources> </subsystem> 4. add a management user to access web console $ bin/add-user.sh -u admin -p StrongPass1! 5. start JBoss EAP 8.0.3 $ bin/standalone.sh 6. access http://localhost:9990/ with brower, then open a Add XA Datasource wizard [Configuration] - [Subsystems] - [Datasource & Drivers] - [Datasources] - click + button - Add XA Datasource wizard 7. Put following parameters to the wizard Choose Template: PostgreSQL Attributes: Name: PostgresXADS JNDI Name: java:/PostgresXADS JDBC Driver: Driver Name: postgresql Driver XA Datasource Class: org.postgresql.xa.PGXADataSource XA Properties: serverName=127.0.0.1 portNumber=5432 databaseName=postgres Connection: User Name: postgres Password: postgres 8. click Test connection, but it will fail. Because XA propery <DatabaseName> added by the wizard by default even if databaseName=postgres is set in the wizard: <xa-datasource jndi-name= "java:/PostgresXADS" pool-name= "PostgresXADS" > <xa-datasource-property name= "&lt;DatabaseName&gt;" > <<== postgresdb <<== </xa-datasource-property> <<== <xa-datasource-property name= "serverName" > 127.0.0.1 </xa-datasource-property> <xa-datasource-property name= "portNumber" > 5432 </xa-datasource-property> <xa-datasource-property name= "databaseName" > postgres </xa-datasource-property> <xa-datasource-class> org.postgresql.xa.PGXADataSource </xa-datasource-class> <driver> postgresql </driver> <security> <user-name> postgres </user-name> <password> postgres </password> </security> <validation> <valid-connection-checker class-name= "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker" /> <validate-on-match> true </validate-on-match> <exception-sorter class-name= "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter" /> </validation> </xa-datasource>

      When we create a new XA data source for PostgreSQL using DB wizard in the web console, <xa-datasource-property name="<DatabaseName>"> that has not been input in wizard is generated by default. The expected behavior is that if databaseName is input in the wizard, DatabaseName will not be automatically generated.

      <xa-datasource jndi-name="java:/PostgresXADS" pool-name="PostgresXADS">
          <xa-datasource-property name="&lt;DatabaseName&gt;">  <<==
              postgresdb                                        <<==
          </xa-datasource-property>                             <<==
          <xa-datasource-property name="serverName">
              127.0.0.1
          </xa-datasource-property>
          <xa-datasource-property name="portNumber">
              5432
          </xa-datasource-property>
          <xa-datasource-property name="databaseName">
              postgres
          </xa-datasource-property>
      

              hpehl@redhat.com Harald Pehl
              rhn-support-ivassile Ilia Vassilev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: