Wildfly 10 can't connect datasource: invalid connection

Freki picture Freki · Nov 10, 2016 · Viewed 28.9k times · Source

Problem

I'm trying test my connection and it keeps giving me the same error while at first sight I can't see what I did wrong. Maybe I'm overlooking something...

Error

    nexpected HTTP response: 500

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

    Response

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


Standalone-full.xml

    <subsystem xmlns="urn:jboss:domain:datasources:4.0">
                <datasources>
                    <datasource jta="true" jndi-name="java:/ProjectenDS" pool-name="ProjectenDS" enabled="true" use-ccm="true">
                        <connection-url>jdbc:mysql://localhost:3306/projecten3db</connection-url>
                <driver-class>com.mysql.jdbc.Driver</driver-class>
                <driver>mysql-connector-java-5.1.40-bin.jar_com.mysql.jdbc.Driver_5_1</driver>
                <pool>
                    <min-pool-size>10</min-pool-size>
                    <initial-pool-size>11</initial-pool-size>
                    <max-pool-size>100</max-pool-size>
                </pool>
                <security>
                    <user-name>projecten</user-name>
                    <password>projecten</password>
                </security>
                <validation>
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
                    <background-validation>true</background-validation>
                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
                </validation>
            </datasource>
        </datasources>
    </subsystem>

Answer

user2543120 picture user2543120 · Feb 17, 2017

The exception you have is generic.

Check on {WILDFLY_HOME}/standalone/log/server.log

You can use tail -f server.log while you test on the web console.

This will give you the right error to work on.