2014-02-11 120 views
-1

我收到此錯誤:如何在Java/Groovy的聲明堆棧大小(確認錯誤:堆棧太大)

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',  '[email protected]') 
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()] 
    } 
} 

我發現這個線程,即解決了這個問題恕我直言:

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

,但我不完全得到如何計算和申報堆棧大小。我也不明白,爲什麼我必須聲明它,因爲其他方法不需要它。 感謝您的幫助!

+0

使用Oracle的/ Sun的JVM,使用'-Xss '(如'-Xss256k')可以設置每個線程的堆棧大小。不知道groovy,但因爲它運行在JVM中... – fge

+0

什麼版本的grails?你如何運行它?這是在tomcat中作爲戰爭運行嗎? –

回答

0

問題就消失了,沒有我改變什麼,我不知道爲什麼