Solved

xpath using dom4j- java.lang.OutOfMemoryError: Java heap space

Posted on 2009-03-29
2
1,439 Views
Last Modified: 2013-11-23
I am reading an xml file using dom4j,xpath expressions to extract fields.The xml file is very large
and I get the following error:
Exception in thread "main"  java.lang.OutOfMemoryError: Java heap space.
What is the best way to avoid this problem.
Thanks
0
Comment
Question by:aswam1975
2 Comments
 
LVL 20

Accepted Solution

by:
Venabili earned 50 total points
Comment Utility
How do you use dom4j? Are you using DOM or SAX?
Don't use DOM -- it tries to read the whole file in the memory.  So for big files, you will always have issues -- you can increase the heap memory but as soon as you try a bigger file (or more than one) and you will be back in the same mess.

If you are using SAX and you still have this issues - post some code because you should not have issues.
0
 

Author Comment

by:aswam1975
Comment Utility
ok- I was using dom,
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now