• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parse file exception

 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try passing a url (java.net.URL) , instead of a string
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the stack trace and see what lines of code are involved in the problem.
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic