0

I have a requirement to upload a document to SharePoint by converting a .txt file to Excel and then send the document to a REST service by converting the excel into a byteArray.

The implementation was done and the code is working fine, however I have a written a simple Junit class which runs without any issue when I run as Junit but when I run my application as a maven build I am getting java.lang.OutOfMemoryError: PermGen space error. If I just ignore this test class the build is getting successful. I have no clues why this test class is causing the perm gen space issue.

I have tried increasing the perm gen space in environment variables, Maven pom.xml and eclipse configuration file but no luck.

Sample test case:

public void testUploadRenewalReportToSharePoint() throws Exception { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("renewal_DOC1_log.txt"); byte[] byteArray = renewalLetterDoc1Service.generateRenewalReport(inputStream); assertEquals( "XXXX/RenewalReport_September_2017.xls", sharePointService.upload(byteArray, "RenewalReport_September_2017.xls").getPath()); } 

Could someone please help me root cause of the issue?

4
  • When you say increasing the perm gen size did not help, did you validate that it was indeed bigger after your configuration change? It might still be too small. Look at your GC logs (or use jconsole) and validate your increase. Commented Nov 26, 2018 at 23:56
  • Thanks Nic, I was able to fix by adding the below configuration in my pom.xml. Earlier I only increased the Perm Gen space but now increased the heap memory as well, so it worked. <configuration> <argLine>-Xms1024m -Xmx2048m -XX:PermSize=1024m -XX:MaxPermSize=2048m</argLine> </configuration> Commented Nov 27, 2018 at 19:15
  • ok. You can answer your question yourself, so if users search for this in the future, they will have an answer right away. Commented Nov 27, 2018 at 19:17
  • Yes Nic, thank you!! Appreciate your help!! Commented Nov 27, 2018 at 19:47

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.