-1

I am converting json string to JSONOBJECT and i use import org.json.JSONObject but i use this

String jsonString = "{\"stat\": { \"sdr\": \"aa:bb:cc:dd:ee:ff\", \"rcv\": \"aa:bb:cc:dd:ee:ff\", \"time\": \"UTC in millis\", \"type\": 1, \"subt\": 1, \"argv\": [{\"type\": 1, \"val\":\"stackoverflow\"}]}}"; JSONObject jsonObject = new JSONObject(jsonString);

result: i get error

'Handler proccessing failed; nestedexception is java.lang.NoClassDefFoundError: org/json/JSONObject'

i have json-20170516.jar into spring-mvc project and i run this project in tomcat server. i have onother project simple java project and using above code for this simple java project and thisworked correctly. i'm confusing for above problem.

1
  • i am using JSONObject onto spring-mvc project. Commented Jun 1, 2017 at 9:35

1 Answer 1

-1

NoClassDefFoundError occurs when your jars are missing. The json jar should either be provided explicitly or as a shared library in your server. Once the jar is added, your issue should be resolved.


Note: You should mention a lot more details like

  • how are you running the code (as a standalone or on a server)
  • if you are running on a server, which is the server, what is the java runtime
  • also, format the code as

String jsonString = ""; //all your code snippet

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for answer, i use 'json-20170516.jar' into spring-mvc project and i run this project in tomcat server. but i get above error.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.