Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Unknown entity bean class issue with glassfish v3
Unknown entity bean class issue with glassfish v3 [message #632275] Tue, 12 October 2010 07:54 Go to next message
Christian S is currently offline Christian S
Messages: 6
Registered: October 2010
Junior Member
Hello everybody,

I am developing an application running on a glassfish v3 server using eclipelink as JPA provider.
When I use the autodeploy function to deploy a new version of my application, all Entity classes are not found anymore:

java.lang.IllegalArgumentException: Unknown entity bean class: class de.xxx.module.dwh.table.FedRawClick, please verify that this class has been marked with the @Entity annotation.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find( EntityManagerImpl.java:576)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find( EntityManagerImpl.java:460)


Yes, the class FedRawClick has an @Entity annotation.
After a restart of the domain everything is working fine again.

Also changes in the persistence.xml are ignored until I restart the domain.

Is this an eclipselink issue or an glassfish autodeploy issue?

Is there a Cache which can be flushed programmatically to solve this problem?

I have already tried this without any success:

em.getEntityManagerFactory().getCache().evictAll();

((JpaEntityManager) em.getDelegate()).getServerSession().getIdentityMapAccessor().initializeAllIdentityMaps();


I am very thankful for every support.

Reagrds,
Christian
Re: Unknown entity bean class issue with glassfish v3 [message #632297 is a reply to message #632275] Tue, 12 October 2010 09:37 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 863
Registered: July 2009
Senior Member
It looks like a classloader issue, such that the EntityManager is using the old classloader. How are you obtaining your EntityManagers and/or factories?

Best Regards,
Chris
Re: Unknown entity bean class issue with glassfish v3 [message #632330 is a reply to message #632275] Tue, 12 October 2010 11:01 Go to previous messageGo to next message
Christian S is currently offline Christian S
Messages: 6
Registered: October 2010
Junior Member
Hi Chris,

thank you for you reply.

Here is the code:

String instanceToken = "xxx";

EntityManagerFactory emf = Persistence.createEntityManagerFactory("dw_" + instanceToken));

EntityManager em = emf.createEntityManager();

Re: Unknown entity bean class issue with glassfish v3 [message #632386 is a reply to message #632330] Tue, 12 October 2010 14:02 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 863
Registered: July 2009
Senior Member
Hello Christian,

Looks like you are accessing a persistence unit outside of the container. Since it is not container managed, the application will need to call close on the factory when it is undeployed (or when it no longer needs the factory) so that it is released. It will not be cleaned up by finalize until the container is shut down.

Best Regards,
Chris
icon14.gif  Re: Unknown entity bean class issue with glassfish v3 [message #632425 is a reply to message #632275] Tue, 12 October 2010 16:34 Go to previous message
Christian S is currently offline Christian S
Messages: 6
Registered: October 2010
Junior Member
Hi Chris,

wow, it seems to work Smile

I added a

@PreDestroy
public void destruct()
{
    emf.close();
}


to the bean, which manages the factories.
Now I don't have to restart the domain.

Very much thanks to you!
This helps me a lot!

Best Regards,
Christian
Previous Topic:Parsing error in JPQL query
Next Topic:Strange behavior in loading entities
Goto Forum:
  


Current Time: Fri May 24 08:47:47 EDT 2013

Powered by FUDForum. Page generated in 0.10842 seconds