I have traced an issue with an application I am developing, it is giving me a type cast exception. Funny thing is it is saying it cannot cast "entities.Movie cannot be cast to entities.Movie"?! movies is an ArrayList.
try {
movies = getMovies();
} catch (Exception e) {
e.printStackTrace(System.out);
} finally {
try {
for (Movie movie : movies) {
output.append(" <tr>\n");
output.append(" <td>" + movie.getId() + "</td>");
output.append(" </tr>\n");
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
Sounds like a classloader conflict. The same class definition, loaded by different classloaders, is seen as two distinct classes by the JVM.
With this little info, there is not much more to say. See this article for details on classloaders and their problems.
See also this earlier answer of mine to a similar problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With