No Persistence provider for EntityManager named

前端 未结 30 1998
甜味超标
甜味超标 2020-11-22 03:45

I have my persistence.xml with the same name using TopLink under the META-INF directory. Then, I have my code calling it with:

30条回答
  •  北海茫月
    2020-11-22 04:29

    The question has been answered already, but just wanted to post a tip that was holding me up. This exception was being thrown after previous errors. I was getting this:

    property toplink.platform.class.name is deprecated, property toplink.target-database should be used instead.
    

    Even though I had changed the persistence.xml to include the new property name:

    
    

    Following the message about the deprecated property name I was getting the same PersistenceException like above and a whole other string of exceptions. My tip: make sure to check the beginning of the exception sausage.

    There seems to be a bug in Glassfish v2.1.1 where redeploys or undeploys and deploys are not updating the persistence.xml, which is being cached somewhere. I had to restart the server and then it worked.

提交回复
热议问题