3

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?

Balder
  • 8,623
  • 4
  • 39
  • 61
  • This question is no duplicate of the linked question at all. I edited both question and answer to make this more clear. – Balder Jan 24 '20 at 10:41

4 Answers4

2

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.

Balder
  • 8,623
  • 4
  • 39
  • 61
nassim
  • 1,547
  • 1
  • 14
  • 26
  • Thanks, this was really useful. I was trying to set a user library for Dali and got this message even though the class `javax.persistence.Convert` was on the classpath. After moving the library folder out of the Eclipse project folder, this error message magically disappeard. – Balder Jan 24 '20 at 10:21
  • Unfortunately, this did not fix the issue for me. – landesko Mar 21 '21 at 19:02
2

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
Thorsten Niehues
  • 13,712
  • 22
  • 78
  • 113
1

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.

0

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

Th3Arock
  • 1
  • 4