0

I am having an Action class in struts2 application and i want to display a docx file to the user. When i load the file with InputStream the file opens without problem

fileStream = new DataInputStream(
          new FileInputStream("d:/deleme/sample.docx")); 

The file of docx is about 26Kb and 7 pages. but when i add the following statement in Action

   WordprocessingMLPackage wordMLPackage =
                WordprocessingMLPackage.load(new FileInputStream(new java.io.File("d:/deleme/sample.docx")));

with no other modification to the previews code tomcat crashes with

Caused by: java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method)

How can i work docx with an action (google did not helped at all)

  • How much PermGen space does Tomcat have? Give it some more ... I suspect the issue here is not the size of the docx file, but the large number of classes JAXB has to load to represent the Open XML schemas. – JasonPlutext Feb 05 '14 at 20:57
  • I have try with a very simple docx document with only a line of characters. The tomcat works very well with hibernate and database. – Jim Theodoris Feb 06 '14 at 06:10
  • That's my point, exactly. Doesn't matter whether docx file is a single line, or 50 pages. The permgen space is being consumed by the library itself. Configure tomcat to make it bigger. – JasonPlutext Feb 06 '14 at 08:37

0 Answers0