Skip to main content


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 11:54 Go to next message
Christian S is currently offline Christian SFriend
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 13:37 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
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 15:01 Go to previous messageGo to next message
Christian S is currently offline Christian SFriend
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 18:02 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
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 20:34 Go to previous messageGo to next message
Christian S is currently offline Christian SFriend
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
Re: Unknown entity bean class issue with glassfish v3 [message #1277829 is a reply to message #632425] Wed, 26 March 2014 14:18 Go to previous message
Nitin Soni is currently offline Nitin SoniFriend
Messages: 1
Registered: March 2014
Junior Member
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: Thu Mar 28 18:08:58 GMT 2024

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

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

Back to the top