Hi all,
I finally managed to fix the issue and following is what we did:
Added the below given snippet to the mysql-ds.xml file which does a background check on the connection pool and ensures that there are no stale connection objects in the pool. Apparently, it was the stale connection objects which caused the issue.
<code>
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
<background-validation-millis>100</background-validation-millis>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
</code>
Hope this helps some one who has the same issue and wants to know what could fix it.