J'ai un problème avec Grails où j'ai une application de test avec:Grails: Interrogation Associations Causes groovy.lang.MissingMethodException
class Artist {
static constraints = {
name()
}
static hasMany = [albums:Album]
String name
}
class Album {
static constraints = {
name()
}
static hasMany = [ tracks : Track ]
static belongsTo = [artist: Artist]
String name
}
class Track {
static constraints = {
name()
lyrics(nullable: true)
}
Lyrics lyrics
static belongsTo = [album: Album]
String name
}
La requête suivante (et un plus avancé, la requête d'association imbriquée) travaux dans la console Grails mais échoue avec une groovy.lang.MissingMethodException lors de l'exécution de l'application avec 'app exécuter':
def albumCriteria = tunehub.Album.createCriteria()
def albumResults = albumCriteria.list {
like("name", receivedAlbum)
artist { like("name", receivedArtist) } // Fails here
maxResults(1)
}
Stacktrace:
groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: (tunehub.LyricsService$_getLyrics_closure1_closure2) values: [[email protected]]
Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), any(groovy.lang.Closure), trim()
at tunehub.LyricsService$_getLyrics_closure1.doCall(LyricsService.groovy:61)
at tunehub.LyricsService$_getLyrics_closure1.doCall(LyricsService.groovy)
(...truncated...)
Des pointeurs? Qu'est-ce que cette contrainte signifie exactement?
Pouvez-vous fournir la trace de la pile 'MissingMethodException'? –
groovy.lang.MissingMethodException: Aucune signature de méthode: java.lang.String.call() est applicable pour les types d'arguments: (tunehub.LyricsService $ _getLyrics_closure1_closure2) valeurs: [[email protected]] Solutions possibles: wait (), any(), wait (long), each (groovy.lang.Closure), any (groovy.lang.Closure), trim() \t à tunehub.LyricsService $ _getLyrics_closure1.doCall (LyricsService.groovy: 61) \t at tunehub.LyricsService $ _getLyrics_closure1.doCall (LyricsService.groovy) (... tronqué ...) – Paul
Je ne vois rien d'incorrect, peut-être que je le rate. Êtes-vous sûr que c'est là que l'erreur se produit? –