This error appears when attempting to test the connection to a data source.
As the error suggests, the logs will also record this exception. In the example, the node agent SystemOut.log has the following.
DSRA0174W: Warning: GenericDataSourceHelper is being used. DSRA8040I: Failed to connect to the DataSource "". Encounted java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
This error suggests some problem with the implementation class being used. In this example, the implementation class being used is com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource. The implementation class is obtained from the JAR file being used to connect to the database. Viewing the content of the JAR file can be used to determine the appropriate implementation class. The content of the JAR file will simply be a collection of files and directories. As an example, following is one of the files and directories in the MySQL JAR.
From this we can conclude that the valid implementation class is actually com.mysql.cj.jdbc.MysqlConnectionPoolDataSource. Once you know the valid implementation class, the JDBC provider in WebSphere can be updated to have the valid implementation class.
- In the left panel of the WebSphere admin console, select Resources > JDBC > JDBC Providers.
- Select your JDBC provider.
- Update the implementation class, and select OK.
- Select Save.
If there are no other issues with the JDBC and data source, the test connection should now be successful.