找不到DataSource.groovy。 grails 2.4.4

时间:2015-04-10 07:06:19

标签: java spring hibernate grails gorm

运行应用程序时出现此错误。我正在使用postgres 9.4数据库。我确保DataSource.groovy存在。我在MAC OS X 10.10

grails> r-a
| Starting daemon...
| Compiling 450 source files
| Parent process shutdown. Exiting...
| Error Forked Grails VM exited with error
| Starting daemon.....
| Warning No config found for the application.
| Warning DataSource.groovy not found, assuming dataSource bean is configured by Spring
| Running Grails application
objc[2087]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
| Error 2015-04-10 12:24:40,201 [localhost-startStop-1] ERROR context.ContextLoader  - Context initialization failed
Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: BootStrap
    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 GrailsConfigurationException: Class not found loading Grails application: BootStrap
->>  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 ClassNotFoundException: BootStrap
->>  366 | run       in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    355 | run       in     ''
|    354 | findClass in java.net.URLClassLoader
|    425 | loadClass in java.lang.ClassLoader
|    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-04-10 12:24:40,261 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: BootStrap
Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: BootStrap
    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 GrailsConfigurationException: Class not found loading Grails application: BootStrap
->>  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 ClassNotFoundException: BootStrap
->>  366 | run       in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    355 | run       in     ''
|    354 | findClass in java.net.URLClassLoader
|    425 | loadClass in java.lang.ClassLoader
|    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

|错误2015-04-10 12:24:40,277 [localhost-startStop-1]错误core.StandardContext - 错误listenerStart     |错误2015-04-10 12:24:40,288 [localhost-startStop-1]错误core.StandardContext - 上下文[/ yazh]启动由于先前的错误而失败     |服务器运行。浏览http://localhost:8080/yazh     |应用程序以交互模式加载。输入'stop-app'即可关闭。     |输入要运行的脚本名称。使用TAB完成:     |父进程关闭。退出...     | Error Forked Grails VM退出并显示错误

2 个答案:

答案 0 :(得分:1)

当域,控制器或服务类出现错误时,通常会发生这种情况。使用--stacktrace运行,你就会找到根本原因

答案 1 :(得分:0)

这不是一个很好的答案,但我刚刚遇到了这个错误,并且能够用grails clean和grails编译来摆脱它。