Grails not executing on IntelliJ (NoClassDefFoundError)
I have upgraded my application from grails 1.2.2 to 1.3.1-RC1. While things seem to work when executing grails from command prompt, I cannot make it run from my IDE IntelliJ (last development 开发者_运维百科version).
The error I got straightaway is:
Error executing script RunApp: net/sf/json/JSONException
...
Caused by: java.lang.ClassNotFoundException: net.sf.json.JSONException
Adding the library json-lib.jar
to the modules dependencies does not change anything in IntelliJ.
Also, it seems that there are 2 JSONException classes defined in 2 different packages :
org.codehaus.groovy.grails.web.json
ingrails.jar
- another package
net.sf.json
in json-lib-2.3-jdk15.jar located in lib folder of cloud-foundry plugin
Do you have any idea about what's happening?
In case, someone encountered the same problem, I finally managed to solve the issue without being sure what was the real fix.
In any case, my problem happened after I have upgraded my Grails from 1.2 to 1.3 and I had old libraries attached to plugins. What I did is:
Project Settings -> Modules -> irofoot-grailsPlugins -> Dependencies -> Grails User Library -> Edit -> Detach old libraries (with Grails-1.2 path)
and then it worked (no more ClassNotFoundException)!!
精彩评论