「法無簽名」我有一個Grails,插件被稱爲「listadmin」有一個域模型「清單當然」:Grails的2.2.2服務不知道的領域模型:
package listadmin
class Liste {
String internal_name
String public_name
Boolean edtiable = true
Boolean visible = true
static hasMany = [eintrage : ListenEintrag]
static constraints = {
internal_name(unique : true , blank : false);
}
String toString() {
"${public_name}"
}
}
我服務所謂在同一個模塊(Grails的-插件)「SECO_ListenService」:
package listadmin
class SECO_ListenService {
def getEntriesOfList(String intnalListName) {
def aList = Liste.findByInternal_name(intnalListName)
return aList
}
}
現在,我嘗試從所謂的「institutionadmin」的其他模塊(Grails的-插件)調用此服務。該SECO_ListenService應在inistitutionadmin返回一個字符串列表,用於選擇一個域模型:
package institutionadmin
import listadmin.SECO_ListenService
class Einrichtung {
Long einrichtungs_type
Long type_of_conzept
int anzahl_gruppen
int anzahl_kinder_pro_Gruppe
String offnungszeiten
static hasMany = [rooms : Raum]
static constraints = {
def aList = []
def sECO_ListenService = new SECO_ListenService()
aList=sECO_ListenService.getEntriesOfList("einrichtung_type")
einrichtungs_type(inList: aList)
}
}
如果我嘗試運行與兩個模塊該應用程序。我得到以下錯誤:
Caused by MissingMethodException: No signature of method: listadmin.Liste.methodMissing() is applicable for argument types:() values: []
它似乎是服務類不知道「Liste」 - 域模型。但我不知道錯誤在哪裏。我也嘗試調用其他標準方法,如「findAll」但沒有任何成功。
有沒有人有一個想法,我的錯誤可能是什麼?
您的服務未在'Einrichtung'中聲明爲屬性。 – 2013-05-13 12:36:10
是的,我知道。如果我嘗試定義屬性,那裏有一些錯誤。這就是爲什麼我像普通的類/對象那樣調用服務。但那不應該是問題,或者你認爲是這樣嗎?目前我嘗試以其他方式解決這個問題。我試圖安裝插件:platform-core來調用具有直接依賴性的其他模塊的服務......但還有另一個錯誤:(http://stackoverflow.com/questions/16551275/grails-platform-core-plugin -no-signature-of-method-event-in-domain-model – 2013-05-14 19:29:53
現在我看到你的困境。看到我的回答:-) – 2013-05-15 11:05:57