Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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 messageGo to next message
Eclipse UserFriend
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
Re: Unknown entity bean class issue with glassfish v3 [message #1277829 is a reply to message #632425] Wed, 26 March 2014 10:18 Go to previous message
Eclipse UserFriend
Recently I also got the same problem and I also used
@PreDestroy
public void destruct()
{
......
}
in the web service that was fetching data from database using eclipseLink.

But to be on safer side, I also introduced a ServletContextListener Listener in my web application having public void contextDestroyed(ServletContextEvent event) method to close EntityManagerFactory in case web service's @PreDestroy public void destruct() was not able to close emf for any reason.
I have done to be on safer side because in the production server this issue happens then it will be very very critical because restarting the production server would mean all the applications running in the server will have to restarted.
So closing open emf in web service as well as in listener will make sure that application reployment wont require server re-start.
-Nitin
Previous Topic:Building EclipseLink OSGI from sources
Next Topic:How to create EclipseLink DBWS builder XML file
Goto Forum:
  


Current Time: Wed Jul 23 08:06:21 EDT 2025

Powered by FUDForum. Page generated in 0.04941 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top