非常奇怪的例外

我的代码

 Query q = em.createQuery("SELECT  u FROM Chatuser u");

            List<Chatuser> list = (List<Chatuser>) q.getResultList();
            for (int i = 0; i < list.size(); i++) {
                Object aa = list.get(i);
                Chatuser chatuser = (Chatuser)aa;


例外

   ex = (java.lang.ClassCastException) java.lang.ClassCastException: Entities.service.Chatuser cannot be cast to Entities.service.Chatuser


问题是什么 ?

最佳答案

这篇文章可能还会回答您的问题
Java, getting class cast exception where both classes are exactly the same

冲突的类加载器可能存在问题

10-07 13:14