gpt4 book ai didi

grails - Grails @Resource在PUT上抛出GroovyCastException

转载 作者:行者123 更新时间:2023-12-02 15:30:22 24 4
gpt4 key购买 nike

我有以下域对象:

package example.rest

import grails.rest.Resource

@Resource(uri="/departments", formats=['json', 'xml'])
class Department {

String displayName
Integer locationId
Boolean showModal

static mapping = {
id generator: "assigned"
table "departments"
version false
}

static constraints = {
showModal nullable: true
displayName nullable: true
locationId nullable: true
}
}

GET的工作正常,但是PUT抛出以下异常:
ERROR errors.GrailsExceptionResolver  - GroovyCastException occurred when processing        request: [PUT] /example-rest/departments/21
Cannot cast object 'example.rest.DepartmentController$_update_closure7@6e36bf53' with class 'example.rest.DepartmentController$_update_closure7' to class 'example.rest.DepartmentController'. Stacktrace follows:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'example.rest.DepartmentController$_update_closure7@6e36bf53' with class 'example.rest.DepartmentController$_update_closure7' to class 'example.rest.DepartmentController'
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

任何帮助,将不胜感激。

最佳答案

修复http://jira.grails.org/browse/GRAILS-10972时,我遇到了类似的问题。您的问题应该在Grails 2.3.5中解决(将在本周末发布)。由commit https://github.com/grails/grails-core/commit/d073a93b修复。

确保Config.groovy中的grails.mime.types设置也已更新。必须手动完成。参见GRAILS-10973

关于grails - Grails @Resource在PUT上抛出GroovyCastException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20527987/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com