gpt4 book ai didi

java - Grails 项目中的 ClassCastException

转载 作者:行者123 更新时间:2023-12-01 11:03:17 24 4
gpt4 key购买 nike

我在 grails 项目中遇到了一些关于 ClassCastException 的问题。我不明白这有什么问题。

2015-10-16 14:07:19 | http-bio-8096-exec-10 | ERROR | org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver | ClassCastException occurred when processing request: [POST] /gci/m-t
fr.xxx.use.gci.consumer.rest.MTService cannot be cast to fr.xxx.use.gci.consumer.rest.MTService. Stacktrace follows:
java.lang.ClassCastException: fr.xxx.use.gci.consumer.rest.MTService cannot be cast to fr.xxx.use.gci.consumer.rest.MTService
at fr.xxx.use.gci.MTController$$EPRHJ9I6.save(MTController.groovy:26)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at fr.xxx.xxxxx.authentication.AnnuaireCredentialCheckerFilter.doFilter(AnnuaireCredentialCheckerFilter.groovy:84)
at fr.xxx.xxxxx.security.mock.MockAuthenticationFilter.doFilter(MockAuthenticationFilter.groovy:60)
at com.granicus.grails.plugins.cookiesession.CookieSessionFilter.doFilterInternal(CookieSessionFilter.java:78)
at fr.xxx.use.navigation.NexturlValidationFilter.doFilter(NexturlValidationFilter.groovy:52)
at fr.xxx.use.requestid.RequestIdFilter.doFilter(RequestIdFilter.groovy:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

所以,这是我的 Controller

class MTController {

def mTService

def index() {
render view:'index'
}

def save(){
def flux = request.JSON

if (!flux.numCT || !flux.numST) {
render status: HttpServletResponse.SC_BAD_REQUEST
return
}

def bddId = mTService.saveInfos(flux.numCT, flux.numST)
if (bddId == null) {
render status: HttpServletResponse.SC_BAD_REQUEST
return
}
}

这就是我的服务

class MTService {

def saveInfos(numCT, numST) {
def mTOTD = new InitMT()

mTOTD.numCT = numCT
mTOTD.numST = numST
return mTOTD.save()
}

}

最佳答案

很可能 grails clean 可以解决该问题。该错误非常奇怪,我怀疑正在运行的代码不是您认为正在运行的代码。

关于java - Grails 项目中的 ClassCastException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33170940/

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