我一直在eclipse的STS中开发一个Grails项目,当我从那里运行/调试它时它运行良好,但是当我在Intellij-Idea(v-12.1.4)中打开同一个项目时,它没有运行给我异常跟踪如下:
"C:\Program Files\Java\jdk1.7.0_17\bin\java" -Dgrails.home=C:\grails-2.2.1 -Dbase.dir=C:\Users\nnill2\Documents\workspace-sts-3.2.0.RELEASE\SocialAuthWithSpringSecurity "-Dtools.jar=C:\Program Files\Java\jdk1.7.0_17\lib\tools.jar" -Dgroovy.starter.conf=C:\grails-2.2.1/conf/groovy-starter.conf -Dserver.port=8080 -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -Djline.WindowsTerminal.directConsole=false -javaagent:C:\grails-2.2.1\lib\org.springsource.springloaded\springloaded-core\jars\springloaded-core-1.1.1.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\grails-2.2.1\lib\org.codehaus.groovy\groovy-all\jars\groovy-all-2.0.7.jar;C:\grails-2.2.1\dist\grails-bootstrap-2.2.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\grails-2.2.1/conf/groovy-starter.conf --classpath C:\Users\nnill2\Desktop\dist\dist\socialauth-4.2.jar;C:\Users\nnill2\Desktop\dist\dist\socialauth-cdi-2.1.jar;C:\Users\nnill2\Desktop\dist\dist\socialauth-cmd-utility-1.1.jar;C:\Users\nnill2\Desktop\dist\dist\socialauth-filter-2.4.jar;C:\Users\nnill2\Desktop\dist\dist\socialauth-seam-2.1.jar;C:\Users\nnill2\Desktop\dist\dist\socialauth-spring-2.3.jar run-app
Loading Grails 2.2.1
| Configuring classpath
| Configuring classpath.
| Environment set to development
| Environment set to development.
| Environment set to development..
| Environment set to development...
| Environment set to development....
| Environment set to development.....
| Packaging Grails application
| Packaging Grails application.
| Packaging Grails application..
| Packaging Grails application...
| Packaging Grails application....
| Compiling 1 source files
| Compiling 1 source files.
| Compiling 1 source files..
| Compiling 1 source files...
| Compiling 1 source files....
| Compiling 1 source files.....
| Running Grails application
| Error 2013-06-26 10:11:04,250 [Tomcat-startStop-1] ERROR core.ContainerBase - A child container failed during start
Message: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/SocialAuthWithSpringSecurity]]
Line | Method
->> 252 | innerGet in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 111 | get in java.util.concurrent.FutureTask
| 334 | innerRun in java.util.concurrent.FutureTask$Sync
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/SocialAuthWithSpringSecurity]]
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig;
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
| Error 2013-06-26 10:11:04,376 [main] ERROR core.ContainerBase - A child container failed during start
Message: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
Line | Method
->> 252 | innerGet in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 111 | get in java.util.concurrent.FutureTask
| 140 | doStart in org.grails.plugins.tomcat.InlineExplodedTomcatServer
| 124 | start in org.grails.plugins.tomcat.TomcatServer
| 65 | doCall . in _GrailsRun_groovy$_run_closure1
| 35 | doCall in RunApp$_run_closure1
^ 120 | main . . in com.intellij.rt.execution.application.AppMain
Caused by LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . in java.lang.Thread
Caused by LifecycleException: A child container failed during start
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . in java.lang.Thread
| Error Server failed to start: Failed to start component [StandardServer[-1]] (Use --stacktrace to see the full trace)
Process finished with exit code 1
我已经阅读了许多类似的问题,例如: https://stackoverflow.com/questions/11112483/trying-to-start-tomcat-server-for-the-first-time-and-getting-an-error,https: //stackoverflow.com/questions/11713839/cant-run-app-on-grails,https://stackoverflow.com/questions/10556201/tomcat-7-0-27-not-starting。每个建议都表明项目构建路径中存在一些导致问题的 servlet-api.jar。但是我在我的项目中搜索过它但找不到jar。我正在使用 JDK-7。任何帮助将不胜感激!!!
编辑 该项目使用 grails 命令行工具 (Tools->Grails->Run-Target) 运行得非常好,但只有运行/调试图标失败。