users@glassfish.java.net

Re: bizarre casting problem

From: Jamey Wood <Jamey.Wood_at_sun.com>
Date: Wed, 02 Jan 2008 15:55:09 -0700

I've seen this behavior when a web application isn't careful to close
all EntityManagerFactory and EntityManager instances it creates. (Of
course, if you're using dependency injection to get hold of an
EntityManager, the container takes care of this and you must be running
into some other issue.)

I've found these write-ups helpful on this topic (again, assuming you're
not using dependency injection):

  
http://javanotepad.blogspot.com/2007/05/jpa-entitymanagerfactory-in-web.html
  
http://javanotepad.blogspot.com/2007/06/how-to-close-jpa-entitymanger-in-web.html

--Jamey

Glenn Holmer wrote:
> I have an app that, after being redeployed several times, fails with
> this bizarre error message:
>
> org.lyonlabs.qlink.QUser cannot be cast to org.lyonlabs.qlink.QUser
>
> The app uses JPA/TopLink and was built using NetBeans. I'm deploying to
> GlassFish v2ur1, and there doesn't seem to be any pattern to whether the
> error occurs after redeploying from NetBeans or from the GlassFish admin
> app.
>
> Has anybody else seen something like this?
>
>