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...
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
}
<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>
If your datasource is not XA, open standalone.xml and remove the datasource-class
property from your datasource definition. Wildfly adds it even if you don't specify it whe you create the datasource.
You may have to restart the server to see it working.
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.
I solved this error by reducing pool size and set prefill attribute to false on datasource settings.
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With