This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Parse file exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Parse file exception" Watch "Parse file exception" New topic
Author

Parse file exception

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
I have a java class which is going to parse a XML file. Whenever I want to parse a XML file over the Internet I got an error when creating this object:

org.jdom.Document doc = parser.build("http://www.myDomain.com/myFiles/test.xml");

500 Servlet Exception
java.lang.StackOverflowError

If I choose to parse a file stored on my local machine it works. Why do I get this java.lang.StackOverflowError exception?


[ May 30, 2006: Message edited by: Jeppe Fjord ]
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
try passing a url (java.net.URL) , instead of a string
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Hi, it didn�t help to use a java.net.URL. I still get this exception:

500 Servlet Exception
java.lang.StackOverflowError


[ May 30, 2006: Message edited by: Jeppe Fjord ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Look at the stack trace and see what lines of code are involved in the problem.
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Yes that is my problem, because I don�t get any stackTrace???

JSP call:

Java method:


[ May 30, 2006: Message edited by: Jeppe Fjord ]
[ May 30, 2006: Message edited by: Jeppe Fjord ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

You're running this in a servlet. So "System.out" goes to some log file in your servlet container. Look there for the stack trace.
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Hi Paul,

Why do you think I am running the code in a servlet?

I call an ordinary Java class from a JSP page.

Pat Flickner
Ranch Hand

Joined: Nov 17, 2003
Posts: 173
JSP is Java Server Pages that get compiled into servlets. The fact that you are using Java code within the JSP makes it especially so, although anything with a suffix of .jsp will be compiled as a servlet regardless of whether there is any <% %> code. That's why he thinks you are running this in a servlet.
[ June 02, 2006: Message edited by: Pat Flickner ]
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Hi I haven�t solved the problem...

I still got this Exception printed out in the browser:

500 Servlet Exception
java.lang.StackOverflowError

I am running the app on resin. Do you know where I can find the log file in the servlet container?
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
I found the solution:

I just added which parser to use in the constructor:

org.jdom.input.SAXBuilder parser = new org.jdom.input.SAXBuilder("org.apache.xerces.parsers.SAXParser");

Now I also get the JDOM Exceptions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parse file exception
 
Similar Threads
Access to XML parsing after login authorization
User authentication before parsing XML
Get the URL of the page being redirected to?
Parsing XML file using Xpath in jdk1.4
Validating an XML File