Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] IllegalArgumentException "Object is not a known entity type" on redeploy to glassfish

Could you include the exception stack trace.

Also check you log to see if you got any errors when restarting your server.

Also make sure you are populating your field with instances of B not A, and
check that they are persisted as B's in the database.



DeSilentio wrote:
> 
> It seems part of the problem was that I was referencing entity classes
> using <jar-file>*</jar-file> in the persistent unit. If I use the
> <class>*</class> syntax it works. However, this leads to a new, but
> related, problem.
> 
> I have something like the following.
> 
> 
> @Entity
> class A {
>   // stuff
> }
> 
> @Entity
> class B extends A {
>   // stuff
> }
> 
> @Entity
> class C {
>   @OneToMany
>   List  field; // Populated with A entities
> }
> 
> @Entity
> class D extends C {
>   // field now populated with B entities
>   // somewhere I call something like
>   // B b = (B) field.get(i);
> }
> 
> This works fine the first time I deploy the application. However, if I
> restart the server or redeploy the application then I run into problems.
> Specifically after I retrieve a D from the database I get a
> ClassCastException that A cannot be cast to B.
> 
> Again any help would be appreciated.
> 
> 
> DeSilentio wrote:
>> 
>> I have an application that uses eclipselink that I am trying to deploy to
>> glassfish v2. The application is packaged as an EAR containing a WAR and
>> a jar containing the Persistent Unit (non-container managed). If I deploy
>> my application and the database that the PU corresponds with is empty
>> then everything works fine (for the most part). However if I redeploy the
>> same application without recreating the database then an
>> IllegalArgumentException is thrown on all my entity classes saying that
>> they are not a know entity type. Can anyone shed some light on this for
>> me?
>> 
>> Thanks
>> 
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/IllegalArgumentException-%22Object-is-not-a-known-entity-type%22-on-redeploy-to-glassfish-tp21404036p21417523.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top