创建新用户时Grails Spring Security UI插件出错 - 处理GroovyPageView时出错

时间:2016-08-12 17:24:35

标签: grails spring-security

当我点击链接创建新用户时,我使用Spring Security UI插件收到以下错误:

"Error processing GroovyPageView: Error executing tag <s2ui:form>: Error executing tag <s2ui:tabs>: Error executing tag <s2ui:tab>: Error executing tag <s2ui:textFieldRow>: assert beanType | null"

我使用SpringSecurityCore 2.0.0和SpringSecurityUI 1.0-RC3运行Grails 2.5.5。我没有对插件进行任何定制。

一切都工作正常好几天了。我能够创建角色,我可以搜索和编辑用户。除了创建新用户的能力之外的一切。我花了8个多小时试图调试它。

这里有追踪:

Line | Method
->>  528 | doFilter  in  /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by GrailsTagException: Error executing tag <s2ui:form>: Error executing tag <s2ui:tabs>: Error executing tag <s2ui:tab>: Error executing tag <s2ui:textFieldRow>: assert beanType
   |
   null
->>   35 | doCall    in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by GrailsTagException: Error executing tag <s2ui:tabs>: Error executing tag <s2ui:tab>: Error executing tag <s2ui:textFieldRow>: assert beanType
   |
   null
->>   31 | doCall    in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by GrailsTagException: Error executing tag <s2ui:tab>: Error executing tag <s2ui:textFieldRow>: assert beanType
   |
   null
->>   21 | doCall    in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by GrailsTagException: Error executing tag <s2ui:textFieldRow>: assert beanType
   |
   null
->>   13 | doCall    in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by PowerAssertionError: assert beanType
   |
   null
->>  817 | labelCode in SecurityUiTagLib.groovy

非常感谢任何帮助。提前抱歉,如果这很难理解,我以前从未在这里发布任何内容。

提前致谢。

米克

3 个答案:

答案 0 :(得分:0)

我在grails 3.2org.grails.plugins:spring-security-ui:3.0.0.M2上遇到了同样的问题。 这在这里得到解答:https://github.com/grails-plugins/grails-spring-security-ui/issues/56

问题是spring-security-ui没有正确处理null toString()的值。 简单地在你的域类中添加这样的东西:

String toString(){
    property?: "null property"
}

答案 1 :(得分:0)

延迟回复:新版本的插件在下面添加了这些标记:

<s2ui:formContainer type='register' focus='name' width='800px'>
<s2ui:form beanName='command'>

答案 2 :(得分:0)

同样的问题终于弄明白了。您的commandBean和控制器可能不合适。

在RegisterController.groovy注册表中() 第一行应该在GET上创建一个空的Command Bean

if (!request.post) {
 return [registerCommand: new RegisterCommand()] 
}

您的register.gsp在s2ui:form标记上验证了这一点。确保bean名称相同

<s2ui:formContainer type='register' focus='username' width='800px'>
   <s2ui:form beanName='registerCommand'>