Home arrow static arrow Java Programming [Archive] - stack overflow error when "compiling" a TagHandler class in IBM
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - stack overflow error when "compiling" a TagHandler class in IBM
10 Duke Stars available
This topic has 3 replies on 1 page.

Posts:4
Registered: 8/7/04
stack overflow error when "compiling" a TagHandler class in IBM   
Aug 7, 2004 10:33 PM



 
meda karthik, Aug 7, 2004
Hi,
I am getting a StackOverFlowError during compilation(yes StackOverFlow during compilation !) of a TagHandler class when i am compiling with IBM JDK 1.4.2. The strange thing is, that i dont get the error when i compile the same class with IBM JDK 1.3.1. I am sure that this class is causing the error, because without it,the build goes through fine. I am doing a build of my component through ant. The following is the error i get :

---------------------------ERROR-----------------------------
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.StackOverflowError
[javac] at com.sun.tools.javac.v8.code.Type$ClassType.constType(Type.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitLiteral(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Literal.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Inlined Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribArgs(Attr.java(Inlined Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitApply(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Apply.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribExpr(Attr.java(Inlined Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitApply(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Apply.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribExpr(Attr.java(Inlined Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitApply(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Apply.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribExpr(Attr.java(Inlined Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitApply(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Apply.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java(Compiled Code))
.
.
.
.
.
.
.
.
The above messages continue repeating and finally ends with...

[javac] at com.sun.tools.javac.v8.tree.Tree$MethodDef.accept(Tree.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java(Inlined Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java(Inlined Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribClassBody(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1349)
[javac] at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java(Compiled Code))
[javac] at com.sun.tools.javac.v8.Main.compile(Main.java:586)
[javac] at com.sun.tools.javac.Main.compile(Main.java:67)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
[javac] at java.lang.reflect.Method.invoke(Method.java:391)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:100)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:842)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
[javac] at org.apache.tools.ant.Task.perform(Task.java:341)
[javac] at org.apache.tools.ant.Target.execute(Target.java:309)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[javac] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:397)
[javac] at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:143)
[javac] at org.apache.tools.ant.Task.perform(Task.java:341)
[javac] at org.apache.tools.ant.Target.execute(Target.java:309)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[javac] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:397)
[javac] at org.apache.tools.ant.Task.perform(Task.java:341)
[javac] at org.apache.tools.ant.Target.execute(Target.java:309)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[javac] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[javac] at org.apache.tools.ant.Main.start(Main.java:196)
[javac] at org.apache.tools.ant.Main.main(Main.java:235)

---------------------------ERROR----------------------------- I am also attaching the first few lines of the tag, incase you find some imports are being referenced circularly....here is the TagHandlerClass.........: ------------------CLASS-------------------------------------
package com.ibm.bcg.consoleUI.tags;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.struts.util.MessageResources;

import com.ibm.bcg.consoleUI.forms.FormConstants;
import com.ibm.bcg.consoleUI.forms.SchedulerForm;
import com.ibm.bcg.consoleUI.forms.VCBaseForm;
import com.ibm.bcg.consoleUI.locale.LocaleUtils;
import com.ibm.bcg.shared.ClientInfo;
import com.ibm.bcg.shared.NameIdAssoc;
import com.ibm.bcg.shared.logging.Logger;
import com.ibm.bcg.shared.logging.LoggerFactory;
import java.util.*;
import com.ibm.bcg.consoleUI.action.ActionLists;
import com.ibm.bcg.consoleUI.action.alerts.AlertActionUtil;
import com.ibm.icu.util.Calendar;
import com.ibm.icu.text.NumberFormat;
/**
* @author karthikd
* @version 1.0
*
*/
public class ScheduleTag extends TagSupport {

// The following 3 fields denote the attributes of the tag.
private String formName;
private String requestKey;
private String scheduleController;

private SchedulerForm schedulerForm;
private Logger logger;
private MessageResources resources;
private ClientInfo clientInfo;
private Locale locale;
private HttpServletRequest request;
private JspWriter writer;
private HttpSession session;
private String newLine = "\r\n";
private Calendar cal = null;

public int doStartTag() throws JspException
{
try
{

logger = LoggerFactory.getLoggerInstance();
logger.log(this.getClass(),Logger.PRIORITY_DEBUG,"staring SchedulerTag ******");
request = (HttpServletRequest)pageContext.getRequest();
writer = (JspWriter)pageContext.getOut();
schedulerForm = (SchedulerForm) request.getAttribute(getRequestKey());
session = (HttpSession)pageContext.getSession();
clientInfo = (ClientInfo) session.getAttribute( "clientInfo" );
locale = clientInfo.getLocale();
resources = LocaleUtils.getMessageResources(VCBaseForm.CONSOLE_BUNDLE);
cal = Calendar.getInstance( clientInfo.getFormatLocale() );
// write out the various JavaScript functions required.
writer.println(getScripts());
//write out the main options,i.e Interval Based and Calendar based scheduling options
writer.println(getOptions());

//decide what kind of scheduling screen is needed.
if(schedulerForm.isIntervalBased())
{
logger.log(this.getClass(),Logger.PRIORITY_DEBUG,"Interval based scheduling ******* ");
writer.println(getIntervalScreen());
}
else
{
logger.log(this.getClass(),Logger.PRIORITY_DEBUG,"Calendarbased scheduling ******* ");
writer.println(getCalendarScreen());
writer.println(initCalendarScreen());
}


}
catch (Exception e)
{
logger.log(this.getClass(),Logger.PRIORITY_ERROR,"SchedulerTag Handler Exception ******** ");
logger.log(this.getClass(),Logger.PRIORITY_DEBUG,"Inside the catch block of Scheduler Tag ****** ");
throw new JspException("SchedulerTag : " + e.getMessage());

}
return SKIP_BODY;
}

------------------CLASS-------------------------------------
What could cause such a problem? Please help , in need of urgent help !!

regards, karthik .

 

Posts:1,135
Registered: 1/16/04
Re: stack overflow error when "compiling" a TagHandler class in IBM   
Aug 7, 2004 11:46 PM (reply 1 of 3)



 
Hava you tried to compile it manually ???

- MaxxDmg...

- ' He who never sleeps... '
 

Posts:4
Registered: 8/7/04
Re: stack overflow error when "compiling" a TagHandler class in IBM   
Aug 9, 2004 6:16 AM (reply 2 of 3)



 
Hi,

No i have not tried to compile it manually as the file is part of a larger project and there are a lot of other dependencies before i can compile this manually.

In any case i found a work around for the porblem. What was happening is that i had a fairly large function, which was about 250 lines, with a larger number of calls to the "append()" function of the StringBuffer class.
I broke the large function into smaller pieces and now i dont get the error.!

But can somebody explain why this solved the problem. Is it because the compiler is not able to stack up all the activation records for execution during runtime ? But like i mentioned what is it in IBM JDK 1.4.2 which is not allowing this, whereas IBM JDK 1.3.1 is able to do it ?

I did solve my problem, but havent got a logical answer to why this was happening !

would appreciate it if someone sheds some light on this topic .

thanks and regards,
Karthik

 

Posts:31,095
Registered: 4/30/99
Re: stack overflow error when "compiling" a TagHandler class in IBM   
Aug 9, 2004 8:08 AM (reply 3 of 3)



 
The writers of the compiler would like to hear from you. File a bug report with them.
 
This topic has 3 replies on 1 page.