BrownTownCoder February 2016

Grails Run-app exception "ClassNotFoundException: net.sf.json.JSONObject"

I am getting the above exception when i do run-app on my grails application

[java.lang.ClassNotFoundException: net.sf.json.JSONObject
,   at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
,   at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
,   at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
,   at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
,   at groovyx.net.http.HTTPBuilder.(HTTPBuilder.java:175)
,   at com.cm.admanager.adapter.GWebServiceRequest.getXml(GWebServiceRequest.groovy:60)
,   at com.cm.admanager.adapter.GWebServiceRequest$getXml$0.callStatic(Unknown Source)
,   at com.cm.admanager.adapter.GWebServiceRequest.getXml(GWebServiceRequest.groovy:49)
,   at com.cm.admanager.adapter.GWebServiceRequest$getXml.call(Unknown Source)
,   at com.cm.admanager.parser.BaseParser.getWebServiceResultsParsed(BaseParser.groovy:64)
,   at com.cm.admanager.parser.BaseParser$getWebServiceResultsParsed.call(Unknown Source)
,   at nna.autodata.parser.AutodataResultParser.getWebServiceResultsParsed(AutodataResultParser.groovy:530)
,   at nna.autodata.parser.AutodataResultParser$getWebServiceResultsParsed.callCurrent(Unknown Source)
,   at nna.autodata.parser.AutodataResultParser.parseModelLines(AutodataResultParser.groovy:131)
,   at nna.autodata.parser.AutodataResultParser$parseModelLines.call(Unknown Source)
,   at nna.autodata.AutodataService.getModelLines(AutodataService.groovy:58)
,   at nna.autodata.AutodataService$getModelLines.call(Unknown Source)
,   at nna.autodata.AutodataService$getModelLines.call(Unknown Source)
,   at nna.shoppingtools.adapter.StModelLineDataService.getModelLines(StModelLineDataService.groovy:62)
,   at nna.shoppingtools.adapter.StModelLineDataService$getModelLines.call(Unknown Source)
,   at nna.shoppingtools.adapter.StModelLineDataService$getModelLines.call(Unknown Source)
,   at nna.shoppingtools.vehicle.StActiveModelLineService.fetchAutodataModelLines(StActiveMode        

Answers


Vinay Prajapati February 2016

I guess there is problem with the version of json-lib you are using. Try adding below to

BuildConfig.groovy

compile 'net.sf.json-lib:json-lib:2.4'

Notice you dependency which is compile('net.sf.json-lib:json-lib:jar:2.3'). It should be rather compile('net.sf.json-lib:json-lib:2.3'). I would say try with latest version as you would get new features and bugs fixed in that.


BrownTownCoder February 2016

I resolved it. I had to delete the .grails and .ivy2 folder and recompile again. It downloaded all the correct dependencies and worked. Thanks a lot for help guys

Post Status

Asked in February 2016
Viewed 2,254 times
Voted 10
Answered 2 times

Search




Leave an answer