groovy开发报错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了groovy开发报错相关的知识,希望对你有一定的参考价值。

grails.validation.ValidationErrors: 1 errors
Field error in object 'oasyslog.Users' on field 'juese': rejected value [null]; codes [oasyslog.Users.juese.nullable.error.oasyslog.Users.juese,oasyslog.Users.juese.nullable.error.juese,oasyslog.Users.juese.nullable.error.oasyslog.Role,oasyslog.Users.juese.nullable.error,users.juese.nullable.error.oasyslog.Users.juese,users.juese.nullable.error.juese,users.juese.nullable.error.oasyslog.Role,users.juese.nullable.error,oasyslog.Users.juese.nullable.oasyslog.Users.juese,oasyslog.Users.juese.nullable.juese,oasyslog.Users.juese.nullable.oasyslog.Role,oasyslog.Users.juese.nullable,users.juese.nullable.oasyslog.Users.juese,users.juese.nullable.juese,users.juese.nullable.oasyslog.Role,users.juese.nullable,nullable.oasyslog.Users.juese,nullable.juese,nullable.oasyslog.Role,nullable]; arguments [juese,class oasyslog.Users]; default message [[1]类的属性[0]不能为null]

domainclass:
package oasyslog

class Users

String username
String password
static belongsTo = [juese:Role]

static constraints =
username(blank:false,nullable:false,unique:true)
password(blank:false,password:true,nullable:false)





package oasyslog

class Role
String funId
String name
static hasMany =[users:Users]
static constraints =
funId(nullable:false)
name(nullable:false)



有大神吗????

参考技术A juese取值不能为null,你的constraints做了限定,所以报这个错误。追问

什么限定?应该改哪里呢》?

追答

static belongsTo = [juese:Role]

juese不能为null

jenkins执行groovy 脚本报错

参考技术A Jenkins下安装groovy 插件:

编写groovy脚本:

Execute Groovy script'执行报错了,java.io.IOException: Cannot run program "groovy" (in directory "D:\Program Files (x86)\Jenkins\workspace\*******"): CreateProcess error=2, 系统找不到指定的文件。原因是Jenkins没有配置groovy的安装.

Manage Jenkins->Global Tool Configuration:

再次执行成功:

以上是关于groovy开发报错的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Groovy 闭包使用报错 ( 闭包中不能直接使用外部对象的方法 | 需要先设置 delegate 代理 )

错误记录Groovy 工程编译报错 ( java.lang.NoClassDefFoundError: org/apache/tools/ant/util/ReaderInputStream )

websocket 并发报错求助啊

错误记录IntelliJ IDEA 编译 Groovy 项目报错 ( Groovy SDK is not configured for module )

错误记录IntelliJ IDEA 编译 Groovy 项目报错 ( gradle-resources-test:XX: java.lang.NoClassDefFoundError: org )

groovy开发报错