While configuring the datasource, the driver jar (mysql connector/j in this case) should be placed only in the TOMCAT_HOME/common/lib directory and nowhere else. If you have the same jar in WEB-INF/lib or the jre extension directory, this problem is encountered. The solution is to remove the jars from all other places and keep it only in the common/lib directory of Tomcat.
Refer to the Tomcat documentation on how to configure the datasource. This has been mentioned as a note.