'The class 'javax.persistence.Convert' is required to be in the selected libraries

When selecting a user library as the JPA implementation in Eclipse Dali's project settings, the following error message is displayed:

The class 'javax.persistence.Convert' is required to be in the selected libraries

enter image description here

But the class javax.persistence.Convert is correctly included in the classpath of my user library, so how can this problem be resolved?



Solution 1:[1]

This error message may arise, when the persistence jar file of the selected user library is part of your Eclipse project folder (for example in a subdirectory of the project). Eclipse Dali doesn't find the class in this case.

If you try moving this directory out of the project folder and try again, it may work.

It might be a bug.

Solution 2:[2]

First download eclipseLink zip file https://www.eclipse.org/downloads/download.php?file=/rt/eclipselink/releases/3.0.2/eclipselink-3.0.2.v202107120736-2a0820a817.zip

Unzip file downloaded in folder eclipse for example.

From Eclipse -> Windows -> Preference -> Java -> Build Path -> UserLibraries

Click to new -> write, eclipseLinkx.x.x Where x.x.x is the version of eclipseLink downloaded.

After, select eclipseLink and click in Add External Jars. In this step add all jars that contain of .zip eclipseLink downloaded.

Previously download library javax.persistence.Convert you can find to Google.

When download javax.persistence.Convert go back to eclipse and add library javax.persistence.Convert to eclipseLink library added.

Now, you can create projects JPA.

Solution 3:[3]

Download Eclipse Link 2.X.Y (Version 3.x.y seems to have different libs)

From the Download use the libraries / jars

  • eclipselink/jlib/eclipselink.jar
  • eclipselink/jlib/jpa/jakarta.persistence_X.Y.Z.jar

And place them into your user Library by either

  • The "Manage Libraries ..." Button on the very right of your screenshot
    or
  • Eclipse -> Windows -> Preference -> Java -> Build Path -> UserLibraries

Solution 4:[4]

It seems your Eclipse doesn't have the Javax driver in it, so you have to download Javax library and add it in your project. I had this problem and It worked for me. download the latest version from here https://jar-download.com/artifacts/javax

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Balder
Solution 2 Manuel Delgado
Solution 3
Solution 4 Th3Arock