Grails:CLI在应用程序运行时的交互
在应用程序运行时,通过命令行与Grails交互有什么不好的地方吗?例如,我让一个应用程序通过Grails:CLI在应用程序运行时的交互,grails,Grails,在应用程序运行时,通过命令行与Grails交互有什么不好的地方吗?例如,我让一个应用程序通过grailsrun-app目标在本地机器上运行,然后打开另一个命令提示符并创建了一个域类,我注意到它创建了域类和等效的测试类,但在运行应用程序的另一个终端中,我得到了相当多的红色文本,如下所示: | Error 2015-03-01 10:40:10,392 [Thread-10] ERROR plugins.AbstractGrailsPluginManager - Plugin [doma
grailsrun-app
目标在本地机器上运行,然后打开另一个命令提示符并创建了一个域类,我注意到它创建了域类和等效的测试类,但在运行应用程序的另一个终端中,我得到了相当多的红色文本,如下所示:
| Error 2015-03-01 10:40:10,392 [Thread-10] ERROR plugins.AbstractGrailsPluginManager
- Plugin [domainClass:2.3.8] could not reload changes to file [C:\Users\user\Dropbo
x\MoeStuff\Projects\qotd\grails-app\domain\qotd\Quote.groovy]: Ambiguous method overl
oading for method grails.spring.BeanBuilder#registerBeans.
Cannot resolve which method to invoke for [null] due to overlapping prototypes betwee
n:
[interface org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfigurati
on]
[interface org.springframework.beans.factory.support.BeanDefinitionRegistry]
Message: Ambiguous method overloading for method grails.spring.BeanBuilder#registerBe
ans.
Cannot resolve which method to invoke for [null] due to overlapping prototypes betwee
n:
[interface org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfigurati
on]
[interface org.springframework.beans.factory.support.BeanDefinitionRegistry]
Line | Method
->> 3034 | chooseMostSpecificParams in groovy.lang.MetaClassImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 2986 | chooseMethodInternal in ''
| 2929 | chooseMethod . . . . . . . . in ''
| 1204 | getMethodWithCachingInternal in ''
| 3163 | createPogoCallSite . . . . . in ''
| 1306 | createPogoCallSite in groovy.lang.ExpandoMetaClass
| 147 | createPogoSite . . . . . . . in org.codehaus.groovy.runtime.callsite.CallS
iteArray
| 161 | createCallSite in ''
| 45 | defaultCall . . . . . . . . in ''
| 108 | call in org.codehaus.groovy.runtime.callsite.Abstr
actCallSite
| 116 | call . . . . . . . . . . . . in ''
| 156 | doCall in org.codehaus.groovy.grails.plugins.DomainC
lassGrailsPlugin$_closure3
| -2 | invoke0 . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke in ''
| 43 | invoke . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke in java.lang.reflect.Method
| 1254 | jlrMethodInvoke . . . . . . in org.springsource.loaded.ri.ReflectiveInter
ceptor
| 90 | invoke in org.codehaus.groovy.reflection.CachedMetho
d
| 233 | doMethodInvoke . . . . . . . in groovy.lang.MetaMethod
| 1086 | invokeMethod in groovy.lang.MetaClassImpl
| 1110 | invokeMethod . . . . . . . . in groovy.lang.ExpandoMetaClass
| 910 | invokeMethod in groovy.lang.MetaClassImpl
| 411 | call . . . . . . . . . . . . in groovy.lang.Closure
| 767 | invokeOnChangeListener in org.codehaus.groovy.grails.plugins.Default
GrailsPlugin
| 716 | notifyOfEvent . . . . . . . in ''
| 731 | notifyOfEvent in ''
| 409 | informOfClassChange . . . . in org.codehaus.groovy.grails.plugins.Abstrac
tGrailsPluginManager
| 367 | informOfFileChange in ''
| 243 | informPluginManager . . . . in org.codehaus.groovy.grails.compiler.Grails
ProjectWatcher
| 46 | access$400 in ''
| 169 | onNew . . . . . . . . . . . in org.codehaus.groovy.grails.compiler.Grails
ProjectWatcher$1
| 210 | cacheFilesForDirectory in org.codehaus.groovy.grails.compiler.Direct
oryWatcher
| 204 | cacheFilesForDirectory . . . in ''
| 187 | checkForNewFiles in ''
| 163 | run . . . . . . . . . . . . in ''
^ 178 | run in org.codehaus.groovy.grails.compiler.Grails
ProjectWatcher
谁能谈谈这个错误是什么意思吗?我是否可以像当初那样做,还是应该在向grails发出任何与人工制品创建/修改有关的命令或与grails进行CLI交互之前停止应用程序的运行?谢谢。最好在创建工件时停止应用程序。修改只要不对类层次结构进行重大修改,通常可以使应用程序保持运行 原因是在开发模式下,Grails监视更改工件并尝试重新加载这些更改。在创建的情况下,它可能恰好在错误的时间命中,并混淆您的应用程序(您在问题中看到的)
重新加载已更改/新的资源(特别是域类)并不完美,但它在大多数情况下都能正常工作。省去您的头痛,在创建过程中停止应用程序。因此grails将尝试编译并加载对文件的更改。因此,您在这里看到的是grails试图编译您修改过的文件或正在修改的文件,但失败了 现在,grails加载和编译更改的能力有多好是一个未知数。它将加载它们,但有时它就是不工作,服务器需要重新启动。此外,监视文件所需的处理器数量可能会过载,尤其是在服务器运行时签出新代码时
这有什么害处吗?嗯,不,这可能行,也可能行不通。您的服务器可能不会反映更改,或者它可能会给您错误的响应,而不是代码所说的响应,因为它无法加载该代码。更改域对象可能会影响数据库或持久层,但某些更改可能与数据库不兼容,因此您必须停止更改。谢谢您的解释。非常感谢,谢谢。给了我进一步的见解。谢谢。