11

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>
Freki
  • 167
  • 1
  • 1
  • 7
  • Have you looked at the logs? They may contain useful information... – assylias Nov 10 '16 at 22:53
  • Yes, I have looked at them. It gives me the same error as displayed above. – Freki Nov 10 '16 at 22:58
  • My answer to [How to link JDBC driver to EJB project missing WEB-INF folder](http://stackoverflow.com/questions/40506761/how-to-link-jdbc-driver-to-ejb-project-missing-web-inf-folder/40508177#40508177) is the easiest. No need to worry about modules or editing XML. – Steve C Nov 10 '16 at 23:49
  • Are your database credentials correct? – Buhake Sindi Nov 17 '16 at 09:16
  • Actually the included thing is not from the server log. Also the server is using the standalone.xml by default. Could You check your configuration? – Hash Jul 05 '17 at 11:28

5 Answers5

8

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.

Tom Wright
  • 2,841
  • 4
  • 22
  • 30
user2543120
  • 131
  • 2
  • 4
1

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>
rodrigomelo
  • 59
  • 1
  • 1
  • 3
1

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.

0

We had such error on MS SQL when our user was not mapped to requested database

Dima Fomin
  • 1,228
  • 1
  • 16
  • 27
0

try to check is there any error like "Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false,"

wrong :jdbc:mysql://localhost:3306/demodb right :jdbc:mysql://localhost:3306/demodb?useSSL=false

...this worked for me!.

and also make sure!

1.mysql connector added 2.turn off "windows firewall" plus any "antivirus" firewall 3.driver class,pool size,connection url with port number

refer: https://mkyong.com/mysql/mysql-establishing-ssl-connection-without-servers-identity-verification-is-not-recommended/

gouessej
  • 3,640
  • 3
  • 33
  • 67