Eclipselink class "javax.persistence.PersistenceUtil"'s signer information does not match signer information of other classes in the same package

Dexxrey :

When I try to create an EntityManager, I get this exception:

java.lang.SecurityException: class "javax.persistence.PersistenceUtil"'s signer information does not match signer information of other classes in the same package

Perhaps it is something with the javax.persistence packages but I don't know how can I fix it.

    public static EntityManager getEntityManager() {
    if(emf == null) {
        emf = Persistence.createEntityManagerFactory("AccountsManager");
    }
    return emf.createEntityManager();
}

Here is the persistence.xml file

  <?xml version="1.0" encoding="UTF-8"?>
  <persistence version="2.1" 
  xmlns="http://xmlns.jcp.org/xml/ns/persistence" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence 
   http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="AccountsManager" transaction- 
                                  type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>model.Account</class>
    <class>model.AllSubscription</class>
    <class>model.Client</class>
</persistence-unit>

I found similar questions but I didn't find any solutions.

Dexxrey :

After I have read all possible similar topics I figured it out.

In the current version of eclipselink(2.7.4) if you add jakarta.persistence_2.2.2.jar alongside with eclipselink.jar this problem occurs. Both jars have some classes and packages with the same name. In order to fix that you have to add jakarta.persistence_2.2.2.jar before the eclipselink.jar. So all the classes are taken from the jakarta not partly.

I don't fully understand how these two libraries interact with each other, but replacing the order in the build path helped.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=94676&siteId=1