3 Replies Latest reply: May 23, 2014 2:59 AM by T. Morton RSS

    BI Publisher 10g WebService + Forms: OutOfMemory with getReportBytes

    T. Morton

      Hello,

       

      I followed this documentation to integrate BI Publisher into Forms.

      http://www.oracle.com/technetwork/middleware/bi-publisher/overview/forms-bip-v22-129995.pdf

       

      Basically, the application written in Oracle Forms calls the BI Publisher WebService through JAVA to run a Report and then download and save it on the application server before run the WEB.SHOW_DOCUMENT to display it.

      It works fine.

       

      However, when the generated report is too big (more than 5 MB), we got the error "OutOfMemory" when downloading it with the following command:

      byte[] binaryBytes = res.getReportBytes(); // Get report content from ReportResponse

      FileOutputStream fio = new FileOutputStream(saveReportPath);

      fio.write(binaryBytes);

      fio.close();

       

      I think the array is getting to big and lead to Java.lang.OutOfMemoryError: PermGem Space.

       

      The exact error message is:

      Exception: java.lang.Exception: javax.xml.rpc.soap.

      SOAPFaultException: java.lang.OutOfMemoryError:

      PermGen Space; nested exception is:

      java.lang.OutOfMemoryError: PermGen space

       

      Does anyone know about an another way to retreive the report generated and save it in a file.

      As I only know, getReportBytes is the only way to retreive the report generated.

       

      I also know that I can increase the limit of memory used by JAVA on my server but it's not really a solution.

       

      Thanks in advance.

        • 1. Re: BI Publisher 10g WebService + Forms: OutOfMemory with getReportBytes
          sfr.farhan

          Hi,

           

          I think problem is not related to following.

           

           

          However, when the generated report is too big (more than 5 MB), we got the error "OutOfMemory" when downloading it with the following command:

          byte[] binaryBytes = res.getReportBytes(); // Get report content from ReportResponse

          FileOutputStream fio = new FileOutputStream(saveReportPath);

          fio.write(binaryBytes);

          fio.close();


          Check the following Doc ID and verify weblogic server startup setting


          WebLogic Server Started as a Windows Service Fails with BEA-101216: java.lang.OutOfMemoryError: PermGen space (Doc ID 1312573.1)


          This issue is generic to any platform where is supported WebLogic Server with Java Hotspot. Although the issue is logged against Admin Server OBIEE, it could potentially happen as part of the installation for other applications that run with the Admin Server or Managed Servers when using SOA, WebCenter, Forms, Primavera P6 and others..

          • 2. Re: BI Publisher 10g WebService + Forms: OutOfMemory with getReportBytes
            T. Morton

            Thank you for your response  but the problem is not link to WebLogic but to OAS 10g.

            • 3. Re: BI Publisher 10g WebService + Forms: OutOfMemory with getReportBytes
              T. Morton

              I finally found how to avoid the OutOfMemory error.

               

              In fact, the error occured when I call the WebService runReport procedure because, when the report has been generated by BI, runReport download it directly in the repResponse Object in a BYTE[] array and so it raise an OutOfMemory error when the report is too big. (Here 45 Mb).

              It's also because, according to the documentation (http://www.oracle.com/technetwork/middleware/bi-publisher/overview/forms-bip-v22-129995.pdf), I set the SizeOfDataChunkDownload = -1 to download the whole generated report.

               

              Too avoid this error when the generated report on BI is too big, I use the downloadReportDataChunk procedure to download it chunk by chunk.

               

              Be aware that the generated document will be chunk only if its size exceed the value of SizeOfDataChunkDownload.

              In other words, even if you set the SizeOfDataChunkDownload to 1000000 byte and the size of the generated document is under 1 Mb, it will be download has a whole in the repResponse object and the FileID will be null.

              It's why I test on repResponse.getReportFileID() != null to choice which download method to use !!!

               

              Hope it can help someone.

               

              For info, the procedure downloadReportDataChunk is only avaible since BI 10.1.3.4:

              https://blogs.oracle.com/xmlpublisher/entry/10134_released

              Oracle Business Intelligence Publisher Administrator's and Developer's Guide

               

              Here is the code:

               

              // Set download size to 1 Mb.

              this.repRequest.setSizeOfDataChunkDownload(1000000);

               

              // Run the report.

              this.repResponse = runReport(this.repRequest, username, password);       

               

              // Download the document chunk by chunk Norris !!!       

              if (this.repResponse.getReportFileID() != null) {

              //
              String reportFileID = repResponse.getReportFileID();      
              ReportDataChunk reportDataChunk;
              int reportFileOffset = 0;
              FileOutputStream fio;      
              //
              do {
                  //
                  reportDataChunk = downloadReportDataChunk(reportFileID, reportFileOffset, 1000000);
                  //
                  if (reportFileOffset == 0) {
                      fio = new FileOutputStream(saveReportPath);
                  } else {
                      fio = new FileOutputStream(saveReportPath, true);
                  }
                  fio.write(reportDataChunk.getReportDataChunk());
                  fio.close();          
                  //         
                  reportFileOffset = reportFileOffset + reportDataChunk.getReportDataChunk().length;         
                
              } while (reportDataChunk.getReportDataChunk().length == 1000000);
              reportDataChunk = null;
                    

              // Download the document as a whole.

              } else if (this.repResponse.getReportBytes().length > 0) {

              //
              FileOutputStream fio = new FileOutputStream(saveReportPath);
              fio.write(this.repResponse.getReportBytes());
              fio.close();

               

              //

              } else {

              throw new Exception("Unable to save report.");

              }