0

I have been reading through SO and several pages of google links, tried all of the approaches there but I cannot get my project running any more.

I am developing a small app and i decided to persist some data in JSON. I downloaded javax.json-api-1.1.jar and javax.json-api-1.1-sources.jar. Eclipse finds the jar file, I can import it, intellisense works, etc. Sadly, when running or debugging I get the following error as soon as the first JSON related line is executed:

Caused by: javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
at javax.json.spi.JsonProvider.provider(JsonProvider.java:99)
at javax.json.Json.createObjectBuilder(Json.java:299)
at tabumaker.view.ChordManagementViewController.handleAddChordSaveBtnOnAction(ChordManagementViewController.java:214)
... 62 more

Caused by: java.lang.ClassNotFoundException: org.glassfish.json.JsonProviderImpl
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.json.spi.JsonProvider.provider(JsonProvider.java:96)
... 64 more

I put both jar files within my workspace and linked them in my eclipse project the following way:

Source attached to jar file:

enter image description here

Source-Lookup-Path set in project:

enter image description here

Source-Lookup-Path:

enter image description here

I really have no idea why it doesn't work. Eclipse has all information to find the API and the corresponding sources within those two jar files.

halfer
  • 19,824
  • 17
  • 99
  • 186
Tremah
  • 103
  • 8
  • please try the solutions provided in this question,https://stackoverflow.com/questions/22812113/http-status-500-provider-org-glassfish-json-jsonproviderimpl-not-found?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Shrikant Havale May 28 '18 at 20:17
  • 1
    Also you have to understand difference between api and its implementation, what you have in classpath is api, and what you need is some implementation of it – Shrikant Havale May 28 '18 at 20:21
  • as i said, i have the source in a jar file as well and i linked it to the api jar file but it still doesnt work, i will check out the thread you linked. thanks – Tremah May 28 '18 at 20:22
  • 1
    source is a source code for the api (jar you attached). its not an implementation. try reading this link for more understanding, https://stackoverflow.com/questions/27984619/what-are-the-api-that-does-implement-jsr-353-json?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Shrikant Havale May 28 '18 at 20:24
  • 2
    thx a lot, i understood the difference now. api and source are just the reference. i chose gson now and it works just fine. Thx :) – Tremah May 28 '18 at 20:41

0 Answers0