ClassCastException

Hi all,

I get this error:

[b]
[i]
StandardWrapperValve[Vaadin Servlet]
: PWC1406: Servlet.service() for servlet Vaadin Servlet threw exception java.lang.ClassCastException: com.delhi.entities.Category cannot be cast to com.delhi.entities.Category

[/i]
[/b]

when I try to run my app on glassfish v2.

Category is a JPA entity object

the offending code according to the server log is:

for (Category c : categories) {
          someList.add(c);
   }

categories is derived from:

List<Category> categories = q.getResultList();

I can verify categories does contains Category object

Any ideas what could be wrong?

This looks like a class loader issue. If a class with the same name is loaded by two different class loaders, they are not considered to be the same (after all, they could be two different binaries, or two different versions of the same file).