Reputation: 13
I am upgrading a Grails 2.4.4 application to Grails 2.5.0 and I'm facing some problems with the tests previously written. The application itself runs fine, however when I run "grails test-app" I get the following exception multiple times:
java.lang.NoClassDefFoundError: grails/gorm/TestCriteriaBuilder
at grails.test.mixin.domain.TestGormStaticApi.createCriteria(DomainClassUnitTestMixin.groovy:199)
at org.grails.datastore.gorm.validation.constraints.UniqueConstraint.processValidate_closure1(UniqueConstraint.groovy:69)
at org.grails.datastore.gorm.validation.constraints.UniqueConstraint.withManualFlushMode_closure2(UniqueConstraint.groovy:109)
at org.grails.datastore.gorm.GormStaticApi.withSession_closure22(GormStaticApi.groovy:687)
at org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:302)
at org.grails.datastore.gorm.AbstractDatastoreApi.execute(AbstractDatastoreApi.groovy:37)
at org.grails.datastore.gorm.GormStaticApi.withSession(GormStaticApi.groovy:686)
at org.grails.datastore.gorm.validation.constraints.UniqueConstraint.withManualFlushMode(UniqueConstraint.groovy:104)
at org.grails.datastore.gorm.validation.constraints.UniqueConstraint.processValidate(UniqueConstraint.groovy:39)
at org.grails.datastore.gorm.GormValidationApi.doValidate(GormValidationApi.groovy:64)
at org.grails.datastore.gorm.GormValidationApi.validate(GormValidationApi.groovy:145)
at org.grails.datastore.gorm.GormInstanceApi.doSave(GormInstanceApi.groovy:172)
at org.grails.datastore.gorm.GormInstanceApi.save_closure5(GormInstanceApi.groovy:162)
at org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:302)
at org.grails.datastore.gorm.AbstractDatastoreApi.execute(AbstractDatastoreApi.groovy:37)
at org.grails.datastore.gorm.GormInstanceApi.save(GormInstanceApi.groovy:161)
at org.grails.datastore.gorm.GormInstanceApi.save(GormInstanceApi.groovy:101)
Tried cleaning and rebuilding without success. I've also tried upgrading to 2.4.5, with the same results, I am using the latest plastic criteria plugin, but it doesn't seem like a factor here. Any clues? Thanks
Upvotes: 1
Views: 451
Reputation: 66
I ran into the same exception when executing unit test after upgrading my application from 2.4.3 to 2.4.5. I manually added the package in the BuildConfig with test scope:
runtime 'org.grails:grails-datastore-gorm:3.1.4.RELEASE'
And it works. You can change the version correspondingly to the Grails you are using.
Upvotes: 4