title: Configuring Mysql DataSource with IBM WebSphere Application Server Liberty Profile
body: <p>I have a spring mvc application which i am deploying on IBM WebSphere Application Server Liberty Profile, the application is supposed to access a mysql database server that is hosted locally. I have added the datasource configuration as follows in the sever.xml file</p>
  
  <pre><code> &lt;dataSource id="springdb" jndiName="jdbc/springdb"&gt;
    &lt;jdbcDriver javax.sql.XADataSource="com.mysql.cj.jdbc.Driver" libraryRef="mysqlJDBCLib"/&gt;
    &lt;properties databaseName="spring_db" password="**********" portNumber="3306" serverName="localhost" user="root"/&gt;
  &lt;/dataSource&gt;
  
  &lt;library id="mysqlJDBCLib"&gt;
    &lt;fileset dir="/opt/IBM/WebSphere/Liberty_16.0.0.4/usr/shared/resources/mysql" includes="mysql-connector-java-6.0.6.jar"/&gt;
  &lt;/library&gt;
  </code></pre>
  
  <p>I am getting the following stack trace</p>
  
  <pre><code>Caused by: java.lang.RuntimeException: java.sql.SQLNonTransientException: DSRA4000E: A valid JDBC driver implementation class was not found for the jdbcDriver dataSource[springdb]/jdbcDriver[default-0] using the library mysqlJDBCLib. [/opt/IBM/WebSphere/Liberty_16.0.0.4/usr/shared/resources/mysql/mysql-connector-java-6.0.6.jar]
  at com.ibm.ws.resource.internal.ResourceFactoryTrackerData$1.getService(ResourceFactoryTrackerData.java:123)
  ... 77 more
  Caused by: java.sql.SQLNonTransientException: DSRA4000E: A valid JDBC driver implementation class was not found for the jdbcDriver dataSource[springdb]/jdbcDriver[default-0] using the library mysqlJDBCLib. [/opt/IBM/WebSphere/Liberty_16.0.0.4/usr/shared/resources/mysql/mysql-connector-java-6.0.6.jar]
  at com.ibm.ws.jdbc.internal.JDBCDriverService.classNotFound(JDBCDriverService.java:196)
  ... 77 more
  Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
  at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:499)
  ... 77 more
  </code></pre>
  
  <p>I have tried the following</p>
  
  <ol>
  <li><p>Replacing com.mysql.cj.jdbc.Driver with com.mysql.jdbc.Driver and string got the same error</p></li>
  <li><p>Replacing javax.sql.XADataSource with javax.sql.DataSource and still got the same error</p></li>
  <li><p>Replacing javax.sql.XADataSource with javax.sql.MysqlConnectionPoolDataSource, same error</p></li>
  <li><p>Switching out the mysql connector jar from mysql-connector-java-6.0.6.jar to mysql-connector-java-5.1.45-bin.jar, still same error (both the jars are there in the specified file path)</p></li>
  </ol>