2016-02-08 58 views
-1

我得到了上面的異常時,我做我的Grails應用程序Grails的運行應用程序異常「ClassNotFoundException的:net.sf.json.JSONObject」

[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(StActiveModelLineService.groovy:257) 
, at nna.shoppingtools.vehicle.StActiveModelLineService.cacheAllActiveModelLinesWithNoMarketingData(StActiveModelLineService.groovy:207) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$$FastClassByCGLIB$$c14200c9.invoke() 
, at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) 
, at org.aspectj.lang.ProceedingJoinPoint$proceed.call(Unknown Source) 
, at cm.springcache.CMCachingAspect$_invokeCachedMethod_closure1.doCall(CMCachingAspect.groovy:31) 
, at cm.springcache.CMCachingAspect$_invokeCachedMethod_closure1.doCall(CMCachingAspect.groovy) 
, at grails.plugin.springcache.SpringcacheService.doWithCacheInternal(SpringcacheService.groovy:155) 
, at grails.plugin.springcache.SpringcacheService.this$2$doWithCacheInternal(SpringcacheService.groovy) 
, at grails.plugin.springcache.SpringcacheService$this$2$doWithCacheInternal.callCurrent(Unknown Source) 
, at grails.plugin.springcache.SpringcacheService.doWithCache(SpringcacheService.groovy:84) 
, at grails.plugin.springcache.SpringcacheService$doWithCache.call(Unknown Source) 
, at cm.springcache.CMCachingAspect.invokeCachedMethod(CMCachingAspect.groovy:30) 
, at nci.nissan.shoppingtools.vehicle.StActiveModelLineService$$EnhancerByCGLIB$$f8b20934.cacheAllActiveModelLinesWithNoMarketingData() 
, at nna.shoppingtools.vehicle.StActiveModelLineService$cacheAllActiveModelLinesWithNoMarketingData.call(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$cacheAllActiveModelLinesWithNoMarketingData.call(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService.getAllActiveModelLinesWithNoMarketingData(StActiveModelLineService.groovy:196) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$getAllActiveModelLinesWithNoMarketingData.callCurrent(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$getAllActiveModelLinesWithNoMarketingData.callCurrent(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService.cacheAllActiveModelLines(StActiveModelLineService.groovy:180) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$$FastClassByCGLIB$$c14200c9.invoke() 
, at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) 
, at org.aspectj.lang.ProceedingJoinPoint$proceed.call(Unknown Source) 
, at cm.springcache.CMCachingAspect$_invokeCachedMethod_closure1.doCall(CMCachingAspect.groovy:31) 
, at cm.springcache.CMCachingAspect$_invokeCachedMethod_closure1.doCall(CMCachingAspect.groovy) 
, at grails.plugin.springcache.SpringcacheService.doWithCacheInternal(SpringcacheService.groovy:155) 
, at grails.plugin.springcache.SpringcacheService.this$2$doWithCacheInternal(SpringcacheService.groovy) 
, at grails.plugin.springcache.SpringcacheService$this$2$doWithCacheInternal.callCurrent(Unknown Source) 
, at grails.plugin.springcache.SpringcacheService.doWithCache(SpringcacheService.groovy:84) 
, at grails.plugin.springcache.SpringcacheService$doWithCache.call(Unknown Source) 
, at cm.springcache.CMCachingAspect.invokeCachedMethod(CMCachingAspect.groovy:30) 
, at nci.nissan.shoppingtools.vehicle.StActiveModelLineService$$EnhancerByCGLIB$$f8b20934.cacheAllActiveModelLines() 
, at nna.shoppingtools.vehicle.StActiveModelLineService$cacheAllActiveModelLines.call(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$cacheAllActiveModelLines.call(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService.getAllActiveModelLines(StActiveModelLineService.groovy:166) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$getAllActiveModelLines.callCurrent(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$getAllActiveModelLines.callCurrent(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService.getActiveModelLines(StActiveModelLineService.groovy:44) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$$FastClassByCGLIB$$c14200c9.invoke() 
, at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) 
, at nci.nissan.shoppingtools.vehicle.StActiveModelLineService$$EnhancerByCGLIB$$f8b20934.getActiveModelLines() 
, at nna.shoppingtools.vehicle.StActiveModelLineService$getActiveModelLines.call(Unknown Source) 
, at nna.shoppingtools.vehicle.StActiveModelLineService$getActiveModelLines.call(Unknown Source) 
, at com.cm.shoppingtools.service.core.ModelLineService.getConfigurableModelLines(ModelLineService.groovy:155) 
, at com.cm.shoppingtools.service.core.ModelLineService$$FastClassByCGLIB$$abffaa9c.invoke() 
, at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) 
, at com.cm.shoppingtools.service.core.ModelLineService$$EnhancerByCGLIB$$63de0fb0.getConfigurableModelLines() 
, at com.cm.shoppingtools.service.core.ModelLineService$getConfigurableModelLines.call(Unknown Source) 
, at com.cm.shoppingtools.service.core.ModelLineService$getConfigurableModelLines.call(Unknown Source) 
, at com.cm.shoppingtools.controller.core.ModelLineController$_closure1.doCall(ModelLineController.groovy:45) 
, at com.cm.shoppingtools.controller.core.ModelLineController$_closure1.doCall(ModelLineController.groovy) 
, at grails.plugin.springcache.web.GrailsFragmentCachingFilter.doFilter(GrailsFragmentCachingFilter.groovy:66) 
, at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:86) 
, at java.lang.Thread.run(Thread.java:695) 
] 

的一點要注意運行的應用程序是應用程序運行並且我得到了網站鏈接,但是當我嘗試訪問我的瀏覽器上的網站時,這是一切都中斷的時候,我得到了這個異常。

我BuildConfig.groovy具有以下依存關係

dependencies { 
    compile('org.hibernate:hibernate-jmx:3.3.1.GA') { 
     excludes 'hibernate-core', 'log4j', 'slf4j-log4j12' 
    } 
    compile('com.google.guava:guava:16.0.1') { // guava:16.0. required for JBoss 7 
     transitive = false 
    } 
    compile('net.sf.json-lib:json-lib:jar:2.3') 
    runtime 'org.apache.httpcomponents:httpcore:4.4.1' 
} 

這是我在我的新工作給予該項目。我沒有寫這個代碼,而且那個人已經離開了公司。

謝謝

+0

你能展示一段導致這個錯誤的代碼嗎? – sphinks

+0

哪個版本的grails? –

+0

Grails版本1.3.7 – BrownTownCoder

回答

2

我想你正在使用的json-lib版本有問題。嘗試添加下面

BuildConfig.groovy

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

通知你的依賴是compile('net.sf.json-lib:json-lib:jar:2.3')。它應該是compile('net.sf.json-lib:json-lib:2.3')。 我會說試試最新版本,因爲你會得到新的功能和錯誤修復。

+0

請參閱上面的我的編輯。 –

+0

所以我試過了。當使用2.4時,我得到了一個不同的imx jar錯誤。該項目甚至沒有編譯。在使用2.3時,出現以下錯誤:使用javac編譯期間編譯錯誤。 錯誤:讀取錯誤/Users/ritwickg/.ivy2/cache/net.sf.json-lib/json-lib/jars/json-lib-2.3.jar;無法讀取zip文件 1錯誤' – BrownTownCoder

+0

嗯!試試grails clean-all。似乎舊的jar沒有被grails刪除。 –

0

我解決了它。我不得不刪除.grails和.ivy2文件夾並重新編譯。它下載了所有正確的依賴關係並工作。非常感謝你們的幫助

+0

這實際上是一個乾淨的;) –

+0

哦,我明白了。謝謝 – BrownTownCoder

相關問題