Error with XWPFDocument

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error with XWPFDocument

joelle latere
Hi,

I’m using POI version 3.17 to create a tools that parse a .docx document, take text and picture from it and copy it to a new document. I have some criteria for paragraph/text to copy.

I word with the original Word document, not huge, something like 94KB with text and Picture inside.


I have an error while doing just :

XWPFDocument document = new XWPFDocument(new FileInputStream(new File(“c:/temp/....docx”)));


I increase the memory of my JVM to 2GB. And the problem still persist


Could you help me, please?


Thank you


This is the error message:

Exception in thread "AgentThread: App" java.lang.OutOfMemoryError: Java heap space

               at org.apache.xmlbeans.impl.store.Cur.createElementXobj(Cur.java:260)

               at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.startElement(Cur.java:2997)

               at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1420)

               at org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)

               at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)

               at org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)

               at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)

               at org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)

               at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)

               at org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)

               at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)

               at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1385)

               at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1370)

               at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:370)

               at org.apache.poi.POIXMLTypeLoader.parse(POIXMLTypeLoader.java:164)

               at org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument$Factory.parse(Unknown Source)

               at org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:152)

               at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:169)

               at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:119)

               at App.NotesMain(App.java:131)

               at lotus.domino.AgentBase.runNotes(Unknown Source)

               at lotus.domino.NotesThread.run(Unknown Source)

Reply | Threaded
Open this post in threaded view
|

Re: Error with XWPFDocument

Dominik Stadler
Can you share the document? Without it it is impossible to reproduce or
suggest anything.

Dominik.

On Tue, Dec 11, 2018 at 6:45 PM joelle latere <[hidden email]> wrote:

> Hi,
>
> I’m using POI version 3.17 to create a tools that parse a .docx document,
> take text and picture from it and copy it to a new document. I have some
> criteria for paragraph/text to copy.
>
> I word with the original Word document, not huge, something like 94KB with
> text and Picture inside.
>
>
> I have an error while doing just :
>
> XWPFDocument document = new XWPFDocument(new FileInputStream(new
> File(“c:/temp/....docx”)));
>
>
> I increase the memory of my JVM to 2GB. And the problem still persist
>
>
> Could you help me, please?
>
>
> Thank you
>
>
> This is the error message:
>
> Exception in thread "AgentThread: App" java.lang.OutOfMemoryError: Java
> heap space
>
>                at
> org.apache.xmlbeans.impl.store.Cur.createElementXobj(Cur.java:260)
>
>                at
> org.apache.xmlbeans.impl.store.Cur$CurLoadContext.startElement(Cur.java:2997)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1420)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1385)
>
>                at
> org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1370)
>
>                at
> org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:370)
>
>                at
> org.apache.poi.POIXMLTypeLoader.parse(POIXMLTypeLoader.java:164)
>
>                at
> org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument$Factory.parse(Unknown
> Source)
>
>                at
> org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:152)
>
>                at
> org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:169)
>
>                at
> org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:119)
>
>                at App.NotesMain(App.java:131)
>
>                at lotus.domino.AgentBase.runNotes(Unknown Source)
>
>                at lotus.domino.NotesThread.run(Unknown Source)
>
>