Ich arbeite an einer Grails App (v 2.4.3) mit einer alten Oracle 10g DB und laufe in den unten stehenden Fehler wenn Sie versuchen, einen Integrationstest für einen Dienst auszuführen. Ich habe sowohl auf Google als auch hier gesucht und kann keine anderen Personen finden, die diesen Fehler während eines Integrationstests für einen Dienst erhalten. Meine Unit Tests auf Domain-Klasse laufen ohne Problem, ich habe nur diesen Fehler mit Integrationstests.Grails 2.4.3 Integrationstestfehler java.lang.NoClassDefFoundError: org/springframework/mock/web/MockAsyncContext
Die App ist so strukturiert, dass alle Anrufe im Ruhezustandskriterium in der Serviceebene ausgeführt werden und sie nicht in die Domänenklasse aufgenommen werden können.
Running 1 integration test...
| Running 1 integration test... 1 of 1
| Failure: test getAllDeliveryTypes(catalog.CatalogServiceSpec)
| java.lang.NoClassDefFoundError: org/springframework/mock/web/MockAsyncContext
at java.lang.Class.privateGetDeclaredMethods(Class.java:2693)
at java.lang.Class.getDeclaredMethods(Class.java:1967)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at grails.test.spock.IntegrationSpec.initRequestEnv(IntegrationSpec.groovy:96)
at grails.test.spock.IntegrationSpec.setup(IntegrationSpec.groovy:62)
Caused by: java.lang.ClassNotFoundException: org.springframework.mock.web.MockAsyncContext
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
... 6 more
| Completed 1 integration test, 1 failed in 0m 0s
Integration Testklasse
package catalog
import grails.test.spock.IntegrationSpec
import spock.lang.*
/**
*
*/
class CatalogServiceSpec extends IntegrationSpec {
static DeliveryType deliveryType
static CatalogService catalogService = new CatalogService()
def setup() {
deliveryType = new DeliveryType()
deliveryType.id = 1
deliveryType.createdById = 101
deliveryType.createdOn = new Date()
deliveryType.modifiedById = 101
deliveryType.modifiedOn = new Date()
deliveryType.code = '01'
deliveryType.name = 'In-Person Classroom'
}
@Unroll("test getAllDeliveryTypes")
def "test getAllDeliveryTypes"() {
when:
def results = catalogService.getAllDeliveryTypes()
then:
results.size() == 1
}
}
Service-Klasse
package catalog
import grails.transaction.Transactional
@Transactional
class CatalogService {
List<DeliveryType> getAllDeliveryTypes() {
List<DeliveryType> deliveryTypes = DeliveryType.list(sort: "id", order: "asc")
return deliveryTypes
}
}
Domain
package catalog
class DeliveryType {
static constraints = {
id range: 1..2500000000
createdById range: 1..2500000000
modifiedById range: 1..2500000000
code maxSize: 6, unique: true
name maxSize: 30
}
static mapping = {
version false
table name: 'delivery_type', schema: 'catalog'
id generator:'assigned'
}
Long id
Long createdById
Date createdOn
Long modifiedById
Date modifiedOn
String code
String name
}
Config-Datei
dependencies {
test "org.grails:grails-datastore-test-support:1.0-grails-2.4"
runtime 'org.springframework:spring-test:3.1.0.RELEASE'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.7'
compile ":asset-pipeline:1.9.6"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.5.5" // or ":hibernate:3.6.10.17"
runtime ":database-migration:1.4.0"
}
Vielen Dank.
Brett