ClassCastException after redeploy

I have a problem every time that I redeploy a project (on NetBeans)
When I try to retrieve any Entity (with Eclipselink or Hibernate, I use both ORM in different projects), throws
: x.xx.xxxx.Usuario cannot be cast to x.xx.xxxx.Usuario.
Glassfish must be restarted to make it work again.
I know the problem is related to classloading issue but I didn’t find a solution yet