My webapplication throws the following ClassCastException:
java.lang.ClassCastException: org.postgresql.jdbc4.Jdbc4ResultSetMetaData
cannot be cast to org.postgresql.jdbc4.Jdbc4ResultSetMetaData
Obviously the classes are the same, so this is a strange error to get.
I found out by using -verbose:class
that the class Jdbc4ResultSetMetaData
gets loaded from two jar files, one in my Jetty lib/ext/ directory and from a /WEB-INF/lib directory in my webapplication. These jar files are exactly the same version (md5sum identical)
This leads me to believe that it is indeed exactly the same class, but the ClassCastException might be caused by two different classloaders loading the same class.
Is it possible to log/trace the name or id of the classloader which loads the classes with a jvm parameter?