File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes StackOverflowError Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "StackOverflowError" Watch "StackOverflowError" New topic
Author

StackOverflowError

Anjali Aggarwal
Greenhorn

Joined: Aug 06, 2011
Posts: 6
Hi,
I am creating a new JSP and including the header and footer jsp files in it. But when I run the code, I get the following exception:

PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.StackOverflowError
at java.io.InputStream.<init>(InputStream.java:28)
at java.io.FileInputStream.<init>(FileInputStream.java:96)
at org.apache.naming.resources.FileDirContext$FileResource.streamContent(FileDirContext.java:1035)
at org.apache.catalina.core.ApplicationContext.getResourceAsStream(ApplicationContext.java:670)
at org.apache.catalina.core.ApplicationContextFacade.getResourceAsStream(ApplicationContextFacade.java:238)
at org.apache.jasper.JspCompilationContext.getResourceAsStream(JspCompilationContext.java:320)
at org.apache.jasper.compiler.JspUtil.getInputStream(JspUtil.java:906)
at org.apache.jasper.xmlparser.XMLEncodingDetector.getEncoding(XMLEncodingDetector.java:143)
at org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:376)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:210)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:156)
at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:390)
at org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:427)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:570)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1642)
at org.apache.jasper.compiler.Parser.parse(Parser.java:181)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:239)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:156)
at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:390)
at org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:427)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:570)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1642)
at org.apache.jasper.compiler.Parser.parse(Parser.java:181)

.
.
.

Can anyone help me in resolving this?
Swastik Dey
Ranch Hand

Joined: Jan 08, 2009
Posts: 990

Can we have a look on the code?


Swastik
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18373

The error comes from the parsing part. This makes me think that you perhaps include a file recursively. Without seeing the code we can't be sure though.

Edit: I've written a simple example which includes itself. My stack trace looks similar. That strengthens my believe about a recursive include.
My test JSP (called test.jsp):


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Anjali Aggarwal
Greenhorn

Joined: Aug 06, 2011
Posts: 6
Thanks Rob.. problem was the same, "recursive inclusion of header.jsp" but the hierarchy was too long to track, but i finally solved the problem.. thanks :)
 
IntelliJ Java IDE
 
subject: StackOverflowError
 
Threads others viewed
Error while migrating from SUN One to JBOSS
include doesn't recognize relative path from sub folder
Mystery Exception: Failed to load or instantiate TagLibraryValidator class
org.apache.jasper.JasperException: File "/tags/struts-html" not found
problem in relative path in jsp page
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture