Grails运行app问题ERROR context.ContextLoader

时间:2015-10-07 16:06:35

标签: grails

当我输入run命令时,它会抛出一个错误。这是我运行命令

时的输出
grails -Dserver.port=8082 run-app

输出:

"C:\Program Files\Java\jdk1.7.0_79\bin\java" -Dgrails.home=C:\grails -Dbase.dir=C:\Supreet\Devs@Work\Source\quick-dining "-Dtools.jar=C:\Program Files\Java\jdk1.7.0_79\lib\tools.jar" -Dgroovy.starter.conf=C:\grails/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -Djline.WindowsTerminal.directConsole=false -javaagent:C:\grails\lib\org.springframework\springloaded\jars\springloaded-1.2.1.RELEASE.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7537 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.6\bin" -Dfile.encoding=UTF-8 -classpath "C:\grails\lib\org.codehaus.groovy\groovy-all\jars\groovy-all-2.3.7.jar;C:\grails\dist\grails-bootstrap-2.4.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.6\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/conf/groovy-starter.conf "run-app -plain-output"
|Loading Grails 2.4.4
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
...........
|Compiling 1 source files
.........................
|Running Grails application
Error |
2015-10-07 21:29:27,074 [localhost-startStop-1] ERROR context.ContextLoader  - Context initialization failed
Message: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
    Line | Method
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Error |
2015-10-07 21:29:27,176 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
Message: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
    Line | Method
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Error |
Forked Grails VM exited with error

Process finished with exit code 1

1 个答案:

答案 0 :(得分:1)

如果applicationContext.xml被删除,您可以轻松恢复它。使用相同版本的Grails创建一个新的空应用程序,然后从那里复制该文件。这不是一个应该编辑的文件,所以应该没问题。

如果缺少sitemesh.xml,还要复制web-app/WEB-INF/tld的.tld文件。