org.apache.commons.dbcp.sqlnestedexception: cannot create poolableconnectionfactory code example

Example: org.apache.commons.dbcp.sqlnestedexception: cannot create poolableconnectionfactory

This is the actual cause of the problem:

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

You have a database communication link problem. Make sure that your application have network access to your database (and the firewall isn't blocking ports to your database).