如何在Java / Groovy中声明堆栈大小(验证错误:堆栈太大)

时间:2014-02-11 10:02:57

标签: java grails groovy stack stack-size

我收到此错误:

Feb 11, 2014 10:32:34 AM org.apache.catalina.core.ApplicationContext log
Information: ContextListener: contextInitialized()
Feb 11, 2014 10:32:34 AM org.apache.catalina.core.ApplicationContext log
Information: SessionListener: contextInitialized()
Feb 11, 2014 10:32:34 AM org.apache.catalina.core.ApplicationContext log
Information: ContextListener:     attributeAdded('org.apache.jasper.compiler.TldLocationsCache',     'org.apache.jasper.compiler.TldLocationsCache@6b2c636d')
Feb 11, 2014 10:43:04 AM org.apache.catalina.core.ApplicationContext log
Information: No Spring WebApplicationInitializer types detected on classpath
Feb 11, 2014 10:43:05 AM org.apache.catalina.core.ApplicationContext log
Information: Initializing Spring root WebApplicationContext
Feb 11, 2014 10:43:06 AM org.apache.catalina.core.StandardContext listenerStart
Schwerwiegend: Exception sending context initialized event to listener instance of class     org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:     Invocation of init method failed; nested exception is java.lang.VerifyError: (class: elektrova/UserController, method: $tt__index signature: (Ljava/lang/Integer;Lorg/springframework/transaction/TransactionStatus;)Ljava/lang/Object;) Stack size too large
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
Caused by: java.lang.VerifyError: (class: elektrova/UserController, method: $tt__index signature: (Ljava/lang/Integer;Lorg/springframework/transaction/TransactionStatus;)Ljava/lang/Object;)     Stack size too large
at java.lang.Class.forName(Class.java:270)
... 5 more

在这种方法中:

def index(Integer max) {
    params.max = Math.min(max ?: 10, 100)

    if(!session.isAdmin){
        Hauler haul = Hauler.get(session.haulerID)
        println haul
        if(params.firstName)
            respond User.findAllWhere([hauler:haul,firstName:params.firstName]), model:[userInstanceCount: User.count()]
        else if(params.lastName)
            respond User.findAllWhere([hauler:haul,lastName:params.lastName]), model:[userInstanceCount: User.count()]
        else if(params.role)
            respond User.findAllWhere([hauler:haul,role:params.role]), model:[userInstanceCount: User.count()]
        else
            respond User.findAllByHauler(haul), model:[userInstanceCount: User.count()]
    }else{
        if(params.firstName){
            model:[userInstanceList: User.findAllByFirstName(params.firstName),userInstanceCount: User.count()]
        }else if(params.lastName)
        model:[userInstanceList: User.findAllByLastName(params.lastName),userInstanceCount: User.count()]
        else if(params.role)
        model:[userInstanceList: User.findAllByRole(params.role),userInstanceCount: User.count()]
        else
        model:[userInstanceList: User.list(params),userInstanceCount: User.count()]
    }
}

我找到了这个线程,解决了问题imho:

VerifyError: Stack size too large (what does it mean?)

但我不太了解如何计算和声明堆栈大小。我也不明白,为什么我必须声明它,因为其他方法不需要它。 谢谢你的帮助!

1 个答案:

答案 0 :(得分:0)

问题消失了,没有我改变任何东西,我不知道为什么