Highlighted

apache poi and OutOfMemoryError

Advisor ,
Dec 09, 2014

Copy link to clipboard

Copied

Hi All,

I am limited to CF standard 9.0.2 with Java Virtual Machine Path = 1024 and -XX:MaxPermSize=512m.

In the pass i was able to fix my memory issue with -XX:-UseGCOverheadLimit, not this time.

The error "java.lang.OutOfMemoryError: Java heap space" is when it is reading and excel macro file (.xlsm) with 2,500 KB already compact using this tech:

http://datapigtechnologies.com/blog/index.php/how-to-compress-xlsx-files-to-the-smallest-possible-si...

My code is:

<!--- new file to write -->

<cfset xlsFile = createObject("java","java.io.FileOutputStream").init(filepath) />

<!--- open stream and read in excel file template --->

<cfset xlsFileTemplate = createObject("java","java.io.FileInputStream").init(filepathtemplate)  />

<cfset newWorkbook = createObject("java","org.apache.poi.ss.usermodel.WorkbookFactory").create(xlsFileTemplate) /> <!--- Error line --->

<!--- read from template to new FileOutput --->

<cfset writeableWorkbook = createObject("java","org.apache.poi.xssf.streaming.SXSSFWorkbook").init(newWorkbook,100) />

<cfset cellStyleStatic = createObject("java","org.apache.poi.xssf.usermodel.XSSFCellStyle") />

Anyone knows a better way to open xlsm file in apache poi?

Any other ideas?

Thanks in advanced.

Using new poi 3.11 beta 3.

Views

2.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

apache poi and OutOfMemoryError

Advisor ,
Dec 09, 2014

Copy link to clipboard

Copied

Hi All,

I am limited to CF standard 9.0.2 with Java Virtual Machine Path = 1024 and -XX:MaxPermSize=512m.

In the pass i was able to fix my memory issue with -XX:-UseGCOverheadLimit, not this time.

The error "java.lang.OutOfMemoryError: Java heap space" is when it is reading and excel macro file (.xlsm) with 2,500 KB already compact using this tech:

http://datapigtechnologies.com/blog/index.php/how-to-compress-xlsx-files-to-the-smallest-possible-si...

My code is:

<!--- new file to write -->

<cfset xlsFile = createObject("java","java.io.FileOutputStream").init(filepath) />

<!--- open stream and read in excel file template --->

<cfset xlsFileTemplate = createObject("java","java.io.FileInputStream").init(filepathtemplate)  />

<cfset newWorkbook = createObject("java","org.apache.poi.ss.usermodel.WorkbookFactory").create(xlsFileTemplate) /> <!--- Error line --->

<!--- read from template to new FileOutput --->

<cfset writeableWorkbook = createObject("java","org.apache.poi.xssf.streaming.SXSSFWorkbook").init(newWorkbook,100) />

<cfset cellStyleStatic = createObject("java","org.apache.poi.xssf.usermodel.XSSFCellStyle") />

Anyone knows a better way to open xlsm file in apache poi?

Any other ideas?

Thanks in advanced.

Using new poi 3.11 beta 3.

Views

2.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 09, 2014 0
Community Beginner ,
Dec 10, 2014

Copy link to clipboard

Copied

Hello!

Let's see if I can help you set up your CF to run your script.

First, your error is the size of the "HEAP SIZE". When you set the "MaxPermSize = 512M." you said to the Java Virtual Machine separate 512 MB only to permanent memory. How do you set up to have a maximum of 1024 total memory for the JVM then consumed half. the "MaxPermSize" is not part of loading the CF applications This memory of 1024 was split for the JVM as follows:

      HEAP = OLD-> 341MB YONG = 171 MB                PERMGEM = 512MB

| -------------------------------------------------------------- | | --------------------------------------- |

           USE YOUR CF SYSTEM                                            NOT USE

I do not know how big the processing but you should think about how the garbage collector uses memory and a case where missing your system uses it will give this error message because in order to process it needs memory and you were not him GC will run and run FULL GC al besides hang your entire application as it does the "Stop the World" and the application stops running.

Advise first decrease maxpermgen to 192MB (it is very inclusive) and as I do not know how your application was created but if you have a lot of data that are killed at the end of the CF request I would use the division to the middle of the "HEAP SIZE"

with the parameter -XX: NewRatio = 1 in configs JVM.

Take a look at the JVM options

Java HotSpot VM Options

Hope this helps.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 10, 2014 0
Advisor ,
Dec 10, 2014

Copy link to clipboard

Copied

Thanks for your reply and help.

I try the parameters as:

-server -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -XX:-UseGCOverheadLimit -Xbatch -XX:NewRatio=1 -Dcoldfusion.rootDir={application.home}/../ -Dcoldfusion.libPath={application.home}/../lib

But still the same issue.

Let me know if you see anything that will not help in these parameters.

Best,

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 10, 2014 0
Advisor ,
Dec 15, 2014

Copy link to clipboard

Copied

Apache poi guys said that the new version 3.11 needs 1.5 GB to work.

I have my CF Enterprise 9.0.2 with JVM=1024. The next link is telling me that I have limitation until 1.8GB:

Maximum JVM heap size greater than 1.8GB will prevent ColdFusion MX from starting

When I move the memory higher that 1024 the server doesn't start.

How can I configure the JVM = 1536GB ? Is this possible or 1024 is the max?

Thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 15, 2014 0
Community Beginner ,
Dec 15, 2014

Copy link to clipboard

Copied

I never tried to put more than 1024 in my room because I never needed but in order to do this you need to have in your memory you have installed ColdFusion. I see no problem in increasing the JVM heap memory to be used. What is the configuration of your server?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 15, 2014 0