Grails find/findAll操作赢得';不行?

Grails find/findAll操作赢得';不行?,grails,groovy,active-directory,ldap,findall,Grails,Groovy,Active Directory,Ldap,Findall,我正在尝试构建一个可以进行LDAP查找的Grails应用程序。我一直在遵循一些指南(和其他一些指南),但我担心没有结束 相关源代码: 从config.groovy: ldap { directories { dir1 { url = "ldap://dc01" base = "ou=someou,dc=check,dc=nl" userDn = "cn=Administrator,cn=Users,dc=check,dc=nl"

我正在尝试构建一个可以进行LDAP查找的Grails应用程序。我一直在遵循一些指南(和其他一些指南),但我担心没有结束

相关源代码: 从config.groovy:

ldap {
directories    { 
    dir1 {
        url = "ldap://dc01"
        base = "ou=someou,dc=check,dc=nl"
        userDn = "cn=Administrator,cn=Users,dc=check,dc=nl"
        password = "wowthisisnothepassword"
    }
}

schemas = [
    ldapclient.GldapoSchemaClassForUser
]}
我的域名类别:

package ldapclient
import gldapo.schema.annotation.GldapoNamingAttribute
import gldapo.schema.annotation.GldapoSynonymFor
import gldapo.schema.annotation.GldapoSchemaFilter

@GldapoSchemaFilter("(objectclass=person)")
class GldapoSchemaClassForUser {
   @GldapoNamingAttribute
   String uid

   @GldapoSynonymFor("cn")
   String name

   @GldapoSynonymFor("mail")
   String email

   @GldapoSynonymFor("uid")
   String username

   @GldapoSynonymFor("fullname")
   String fullName
}
和我的控制器:

package ldapclient

class AdController {
def defaultAction = "list"

List matches = GldapoSchemaClassForUser.findAll(
    filter: "(name=s*)"
)

def list = {
    [ "adMatches" : matches.list() ]
}}
尽管我的程序(据我所知)符合许多文档中应该工作的内容,但我无法运行它。引发的错误为:

原因:groovy.lang.MissingMethodException:没有方法签名:static ldapclient.GldapoSchemaClassForUser.findAll()适用于参数类型:(java.util.LinkedHashMap)值:[[filter:(name=s)]] 位于ldapclient.AdController.(AdController.groovy:6)*

有什么线索吗?我使用的是Grails1.2.3,使用的是最新版本的LDAP插件。项目是干净的(新创建的)

提前谢谢


感谢您的回复;我刚刚升级到Grails1.3.4并移动了一些文件。这做了一些好事,尽管我仍然犯了一个严重的错误:

Error creating bean with name 'ldapclient.AdController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [ldapclient.AdController]: Constructor threw exception; nested exception is groovy.lang.MissingMethodException: No signature of method: static ldapclient.GldapoSchemaClassForUser.findAll() is applicable for argument types: (java.util.LinkedHashMap) values: [[directory:dir1, filter:(uid=myname,ou=st,ou=ouou,dc=dc,dc=dcdc)]] Possible solutions: findAll(groovy.lang.Closure), find(groovy.lang.Closure)
,findAll方法只有以下定义(其中Book-是示例域类):

以及您的代码:

List matches = GldapoSchemaClassForUser.findAll(
    filter: "(name=s*)"
)
可以改写为:

List matches = GldapoSchemaClassForUser.findAllByNameLike("s%")
或使用:

要使用过滤器,请看一下,findAll方法只有以下定义(其中Book是示例域类):

以及您的代码:

List matches = GldapoSchemaClassForUser.findAll(
    filter: "(name=s*)"
)
可以改写为:

List matches = GldapoSchemaClassForUser.findAllByNameLike("s%")
或使用:


要使用过滤器,请查看模式类位于何处?我的这个插件工作得很好(尽管是Grails1.3.4)。请注意,您的插件链接是一个旧的ish页面。以下是我相信的最新消息:


除了看起来您可以在grails app/ldap目录中删除模式类,而不必在配置中指定它们之外,不要认为有太大的区别-我使用配置中指定的模式进行操作的方式与您相同,但可能值得在grails app/ldap文件夹中尝试它们?

您的模式类位于何处?我的这个插件工作得很好(尽管是Grails1.3.4)。请注意,您的插件链接是一个旧的ish页面。以下是我相信的最新消息:


除了看起来您可以在grails app/ldap目录中删除模式类,而不必在Config中指定它们之外,不要认为这有太大的区别-我使用在Config中指定的模式的方式与您相同,但是在grails app/ldap文件夹中尝试它们可能值得吗?

在使用grails 2.2和ldap插件0.8.2的几天中,我遇到了同样的问题。在深入研究gldapo邮件列表存档后,我发现出现这种情况是因为schema类没有注入gldapo行为,因此find/findAll()方法没有正确解析。参考本线程-


我没有在grails Config.groovy脚本中使用“import myPkg.SchemaClass”。

在使用grails 2.2和ldap插件0.8.2的几天中,我遇到了同样的问题。在深入研究gldapo邮件列表存档后,我发现出现这种情况是因为schema类没有注入gldapo行为,因此find/findAll()方法没有正确解析。参考本线程-


我没有在grails Config.groovy脚本中使用“import myPkg.SchemaClass”。

Gldapp模式类不是grails/hibernate域类,因此它们没有相同的约定。find和findAll()有一个DSL,因此findAll(filter:“…”)应该是有效的。这一页似乎也过时了。您可能需要查看源代码(或者,我怀疑是),Gldapp模式类不是grails/hibernate域类,因此它们没有相同的约定。find和findAll()有一个DSL,因此findAll(filter:“…”)应该是有效的。这一页似乎也过时了。你可能必须调查来源(或者,我怀疑)。