自从升级到grails 2.3.5以来,hibernate插件的一个奇怪行为(从版本3.6.10.6迁移到3.6.10.7)导致运行时出现bean错误:
14-01-22 16:22:54,064 ERROR [GrailsContextLoader] - Error initializing the application: Error creating bean with name 'xxx.xxxx.StatisticsValidator': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator.setProxyHandler(org.codehaus.groovy.grails.support.proxy.ProxyHandler); nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.determineCommonAncestor(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.xxx.xxxx.StatisticsValidator': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator.setProxyHandler(org.codehaus.groovy.grails.support.proxy.ProxyHandler); nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.determineCommonAncestor(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator.setProxyHandler(org.codehaus.groovy.grails.support.proxy.ProxyHandler); nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.determineCommonAncestor(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;
这是关注的Statistics
域类,即使自grails 2.3.4以来没有任何更改:
class Statistics implements Serializable {
static belongsTo = [profile: Profile]
Profile profile
String email
String dbkey
String clientCode
String affiliatesNbr
String freeStorageBonus
String freeUsersBonus
String storageUsed
String storageAvailable
String quotaUsersCurrent
String quotaUsersAvailable
String comments
Date processedDate
static constraints = {
profile unique: true, nullable: false, blank: false
email email: true, maxSize: 80, nullable: false, blank: false
dbkey maxSize: 80, nullable: false, blank: false
clientCode maxSize: 40, nullable: false, blank: false
affiliatesNbr maxSize: 40, nullable: true, blank: true
freeStorageBonus maxSize: 40, nullable: true, blank: true
freeUsersBonus maxSize: 40, nullable: true, blank: true
storageUsed maxSize: 40, nullable: true, blank: true
storageAvailable maxSize: 40, nullable: true, blank: true
quotaUsersCurrent maxSize: 40, nullable: true, blank: true
quotaUsersAvailable maxSize: 40, nullable: true, blank: true
comments maxSize: 180, nullable: true, blank: true
processedDate nullable: true, blank: true
}
在使用的插件列表下方:
plugins {
build ":tomcat:7.0.50"
runtime ":hibernate:3.6.10.7"
runtime ":database-migration:1.3.8"
runtime ":resources:1.2.1"
runtime ":jquery:1.8.3" //jquery:1.10.2
compile ":scaffolding:2.0.1"
compile ":cache:1.1.1"
compile ":bean-fields:1.0"
compile ":csv:0.3.1"
compile ":famfamfam:1.0.1"
compile ":form-helper:0.2.8"
compile ":google-chart:0.5.2"
compile ":google-visualization:0.6.2"
compile ":jcaptcha:1.2.1"
compile ":jdbc-pool:7.0.47"
compile ":jquery-ui:1.8.24"
compile ":navigation:1.3.2"
compile ":quartz:1.0.1" //1.0.1
compile ":richui:0.8"
compile ":spring-security-core:2.0-RC2"
compile ":webflow:2.0.8.1"
compile ":rendering:0.4.4"
compile ":modernizr:2.7.1.1"
compile ":spring-security-acl:2.0-RC1"
compile ":pdf-viewer:0.1"
compile ":taggable:1.0.1"
compile ":executor:0.3"
compile ":gmetrics:0.3.1"
compile ":lesscss-resources:1.3.3"
compile ":pretty-size:0.2"
compile ":mysql-connectorj:5.1.22.1"
compile ":font-awesome-resources:4.0.3.0"
compile ":aws-sdk:1.6.12"
compile ":aws:1.6.7.5"
}