ClassCastException in JPA Entitiy after redeploy (Glassfish 3.1.2)

老子叫甜甜 提交于 2019-12-04 08:24:42

Resources tied to the classloader are held statically until the EntityManagerFactories are closed. These are application managed so you must manually call close on the factories on shutdown or undeploy events when they are no longer needed - garbage collection might clean them up as well, but it is not occurring before the app is redeployed and accesses them again with a different classloader, resulting in the exception you see.

Hold onto the factory and close it when no longer needed, or use injection and allow the container to manage it's life cycle for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!