Today I was battling an issue for some of my colleagues. They were getting this exception from JBoss/Mysql ConnectorJ driver:
java.sql.SQLException: Unexpected error in ping : java.lang.IllegalArgumentException: object is not an instance of declaring class
in the JBoss console.
Then making a Google search for above error and we read a bit of forums that was mentioning the error. Which talked about problems due to a bug jconnector mysql. So we tried upgraded from 5.1.6 to 5.1.12 drivers no good. We also downgraded to 5.1.5 still no good. Than we removed the connector from applications WEB-INF/lib folder and placed it under $JBOSS_HOME/server/default/lib. Result: The application is better and I no longer have the above-mentioned exception.