0

We plan to migrate from Jboss 5 to Wildfly 8.2. On the database side, we have a three-node Galera cluster with MariaDB 10.

On Jboss 5, we had the following setting in the ds.xml file:

...
<connection-url>jdbc:mysql:loadbalance://ip-node1,ip-node2,ip-node3/DBname</connection-url>
...

Everything worked well on Jboss 5. But I can't achieve the same on Wildfly 8.2. From the management console I was able to add a non-clustered datasource without problems and it works. Example URL: jdbc:mysql://ip-node1/DBname

But when I try to add the clustered URL as above, I get the following error:

Unexpected HTTP response: 500

Request
{
    "address" => [
        ("subsystem" => "datasources"),
        ("xa-data-source" => "dsName")
    ],
    "operation" => "test-connection-in-pool"
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
    "rolled-back" => true
}

How could I connect Wildfly to a clustered datasource? I know that it is possible to plug an external load balancer like HAProxy but I would prefer to keep the architecture as simple as possible.

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
Ciprian Stoica
  • 2,309
  • 5
  • 22
  • 36

1 Answers1

0

You have to mention the datasource in standalone.xml file inside wildfly-8.2.0.Final_1\standalone\configuration\ as shown below.

 <datasource jndi-name="java:/jdbc/DB1" pool-name="PostgresDS" enabled="true" use-java-context="true">
                        <connection-url>jdbc:postgresql://localhost:5432/DB1</connection-url>
                        <driver>postgres</driver>
                        <security>
                            <user-name>DB1</user-name>
                            <password>DB1</password>
                        </security>
                    </datasource>
                    <datasource jndi-name="java:/jdbc/DB2" pool-name="PostgresDS1" enabled="true" use-java-context="true">
                        <connection-url>jdbc:postgresql://localhost:5432/DB2</connection-url>
                        <driver>postgres</driver>
                        <security>
                            <user-name>DB2</user-name>
                            <password>DB2</password>
                        </security>
                    </datasource>
Vipin CP
  • 3,642
  • 3
  • 33
  • 55
  • I've already tried to define the datasource both directly in the standalone.xml or from the management interface. Both work if I use a non clustered datasource. But none works when I use a clustered datasource as in my initial example. – Ciprian Stoica Sep 21 '15 at 13:35