我有一個應用程序和一個用Grails 2.1.1構建的插件,我升級到了2.2.1,我遇到了一個奇怪的問題。我的應用程序開始爆炸了,因爲在我的應用程序Config.groovy
中定義的配置值突然解決爲groovy.Util.ConfigObject
而不是它們的實際值。這是問題的第一部分,第二部分是,在我的應用程序,我在我的應用程序的Config.groovy
Grails 2.2.1不是閱讀插件配置文件
grails.config.defaults.locations = [
"classpath:DemoPluginConfig.groovy",
]
DemoPluginConfig.groovy
包含此屬性
oo.memcached.timeout=400000
定義和DemoPluginConfig.groovy
文件中的src/java
文件夾我的Demo插件。 我有一個內存緩存服務,而我試圖設置超時財產,一旦該服務已準備就緒:
Caused by MissingMethodException: No signature of method: net.spy.memcached.ConnectionFactoryBuilder.setOpTimeout() is applicable for argument types: (groovy.util.ConfigObject) values: [[:]]
Possible solutions: setOpTimeout(long)
->> 55 | unwrap in org.codehaus.groovy.runtime.ScriptBytecodeAdapter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 46 | call in org.codehaus.groovy.runtime.callsite.PojoMetaClassSite
| 45 | defaultCall . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 108 | call in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 116 | call . . . . . . . . . . . . . in ''
| 20 | afterPropertiesSet in com.millennialmedia.ui.core.MemcachedService
| 1514 | invokeInitMethods . . . . . . . in org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
| 1452 | initializeBean in ''
| 519 | doCreateBean . . . . . . . . . in ''
| 122 | doCreateBean in org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory
| 456 | createBean . . . . . . . . . . in org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
| 271 | resolveInnerBean in org.springframework.beans.factory.support.BeanDefinitionValueResolver
| 126 | resolveValueIfNecessary . . . . in ''
| 1360 | applyPropertyValues in org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
| 1118 | populateBean . . . . . . . . . in ''
如果我嘗試:
def void afterPropertiesSet() {
ConnectionFactoryBuilder cfb = new ConnectionFactoryBuilder()
def config = grailsApplication.config;
def operationTimeOut = config.oo.memcached.timeout
cfb.setOpTimeout(timeOut)
}
的Grails運行的應用程序在這一點上,錯誤炸燬運行Grails運行應用程序多一次它啓動成功,但該應用程序爆炸與另一個加載頁面groovy.Util.ConfigObject
是不可序列化的錯誤。一步一步調試前的應用炸燬表明,我們得到的setOptTimeOut
線的時候,grailsApplication.config
只包含從我的應用程序的Config.groovy中的配置選項,彷彿從插件DemoPLuginConfig.groovy
值只是忽略。
恢復到2.1.1會使一切恢復正常。在這一點上,我不知道在哪裏看。
我也有類似的問題,但在相反的 - 我的插件會將它的conf文件到客戶端的conf目錄並運行Grails的升級(2.2.1)插件的conf漸漸讀優先於客戶端的後版。所以我看到的是grails升級是填充classpath解析和/或排序。 – nickdos 2013-03-28 06:20:44