I have a groovy script working fine with
driver : 'com.cloudera.impala.jdbc.DataSource',
but I was getting the same ClassCastException when running the same code within a Spring Boot application.
By changing the driver there to
driver : 'com.cloudera.impala.jdbc.Driver',
instead of DataSource, I started getting successful connections and query results.