Community
Participate
Working Groups
The error, java.lang.IllegalArgumentException: Object: <object> is not a known entity type. is thrown when you redeploye a non-managed persistence unit on weblogic. The error most likely occurs on other servers. The error occurs because the ServerSession is cached in the EntityManagerSetupImpl static, so on createEntityManagerFactory() the old one is used with the old descriptors/class before the redeployment. If close() is called by the application before the undeploy, it should in theory resolve the issue, but the application generally will not be able to do this. We also have a finalize method, but this does not seem to work. If we cannot fix the issue we should at least (and probably even if we fix it) - improve the error message "java.lang.IllegalArgumentException: Object: <object>, of class <class> is not a known entity type. If a redeployment has occurred the session may have the wrong class loader, and need to be cleared." - add a clear method to our PersistenceProvider, or a destroy method to EntityManagerFactory. I have also seen issues that weaving does not occur for non-managed persistence units. We need to have tests that run in all of our application servers that use a non-managed persistence unit and verify weaving and redeployment and general usage.
There should also be a way to manually undeploy a persistence unit. Their is an undeploy on EntityManagerSetupImpl, but no way to access this from an EntityManagerFactoryImpl. It should have a getEntityManagerSetup method, as well as an undeploy method. Also the cached setup impls in the static EntityManagerSetupImpl never seem to ever get cleared, this does not seem correct.
i have same issue any news to solve it >>>>>work around restart the server
Just moved from JPA 1/Eclipse 2.1 to JPA 2/Eclipse 2.3 and started encountering this problem. Having to bounce WebLogic every time I do a redeploy is becoming time-consuming. Is this fixed in a later release? Are there any plans to fix it in 2.3?
I tried implementing a listener in WebLogic with a preStop method that closes the EntityManagerFactory. This had no effect.
Encounter the same issue, definitely there is a caching of old class definition issue. The classloader of eclipselink library is the WebLogic system class loader whereas the classloader of the entity classes is the EAR application class loader, everytime when redeployment of application occur, a new set of entity classes are loaded in a new EAR application class loader. Somehow the eclipselink's EntityManagerFactory in the WebLogic system class loader still reference to the old entity classes definition. So, everytime need to restart the server when re-deployment is needed.
This issue happen when u create EntityManagerFactory manulally like Persistence.createEntityManagerFactory serveral times. Your application should create it once on startup and destory it when the application undeploy If its web app create ServletContextListener *in contextInitialized method create it once[as golobal varibale or using single tone class] EntityManagerFactory fact = Persistence.createEntityManagerFactory *and in contextDestroyed method fact.close()
(In reply to Ahmed Abb Elmaksoud from comment #6) > This issue happen when u create EntityManagerFactory manulally like > Persistence.createEntityManagerFactory serveral times. > Your application should create it once on startup and destory it when the > application undeploy > If its web app create ServletContextListener > > *in contextInitialized method create it once[as golobal varibale or using > single tone class] EntityManagerFactory fact = > Persistence.createEntityManagerFactory > > > *and in contextDestroyed method fact.close() In my case, no, it is managed by the server, I called it through injection annotation @PersistenceContext. I am not sure how to close the container-managed EntityManagerFactory.
Try to search in your app anyone else is using EntityManagerFactory or not may be any other Lib
I think there is no bug. I had the same behaviour because of not closing the persistence service. Into my infraestrcuture i use weblogic + eclipselink + guice-persist. Guice has a PersisteService. In many example u can see how to start this service... but not to stop it. If you don't stop it the behaviour is that after a redploy Weblogic does not know about the entities, getting an ", "not a known entity type" error. ... but if you stop the PersistService, there is no issue.!!! I started also an Stackoverflow post about this: http://stackoverflow.com/questions/28604296/eclipselink-jpa-guice-persist-and-redeployments
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink