My Grails App Server keeps restarting over and over
I was making various small changes to my app and at some point the grails app server decides that it needs to restart over and over and over.
开发者_如何学GoAnybody else seen this crazy behavior. I cannot really upload my whole app as an example. I have no idea what I did. I wasn't making any configuration changes or plugin changes.
I'm using grails 1.2.
-- As I wrote this email, I tried it again and I get a slightly different behavior.
It goes to restart the app and gives the message that it is Compiling 1 Source file and keeps recompiling the one message.
Not sure if this is your problem, but I've observed something like this when there is something minor wrong with one of your class names or packages, i.e. say you have a package org.grails.plugin in directory org.grails.foo. That for some reason causes recompilation.
To catch some of this errors, I modified my GRAILS_HOME\scripts_GrailsCompile.groovy by making it print out the files it's compiling.
To modify:
search for ant.groovyc and add listfiles:"yes" to the parameters.
Example:
ant.groovyc(destdir:classesDirPath,
classpathref:classpathId,
listfiles:"yes",
encoding:"UTF-8",
compilerPaths.curry(classpathId, false)
)
This way if you see the exact same files keeps getting recompiled, you know where to look.
Many thanks to kdj for pointing out that future timestamps can cause the continuous restart error as well.
So there are at least two ways continuous restart can happen 1) package names do not match folder structure 2) One or more class files have future timestamps relative to the server date
In my case, something odd happened on my dev box during the DST changeover and timestamps on some generated class files were set 2 days in the future.
I know this is an old question, but I just ran into the same issue. Starting the grails application would cause it to recompile over and over again. My issue was related to the name of the Groovy class file NOT matching the name of the class within the file. The code was fine, but the names were different. Once I changed the names so they were in sync, the issue was resolved. To build on the accepted answer you can use:
grails run-app -verboseCompile
to make grails print out the offending script/class file when it compiles over and over. It lead me to the offending module. If you look at the script 'GRAILS_HOME\scripts_GrailsCompile.groovy` you can see that they put this option into place so that you could override the value at startup. You probably do not want to modify the originals if you can help it (like the original, accepted answer).
This was done in grails 1.3.7.
If grails is running in dev mode, and the source code is on a remote file system, and the remote file server has its time set in the future, then this is what you'll get.
I ran into the same issue and two different things resolved it for me. One was simply restarting the system and the other was running grails run-app. Verbose compile didn't show any issues with my project.
Also, make sure your fileName.groovy
matches your className
.
I copied some code from another project one time and ran into this situation.
精彩评论