Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jsf having a jasper report custom component is not showing (JDev 12.2.1.2)

Mike2018Feb 20 2018 — edited Feb 25 2018

hi All,

Requirement & Current Setting

I have am working on Custom component which is supposed to get a compiled jasper report from database and then generate a pdf output based on passed parameters.

Before I used to store the *.jasper on the calling fusion application and then we decided to store them on an Oracle DB (BLOB column). To retrieve the report form DB I am using the below function:

The custom component https://drive.google.com/file/d/1BGDEBovSpG_Pi0uhVtb82KNaw3RbqjN4/view?usp=sharing

public BufferedInputStream downloadReportFile(String reptCode){

    DCIteratorBinding reportIter = (DCIteratorBinding) getBindingsCont().get("RepReportsViewIterator");

    ViewObject vo = reportIter.getViewObject();

    RowSetIterator createRowSetIterator = vo.createRowSetIterator(null);

    Row\[\] rows = createRowSetIterator.getFilteredRows("ReptCode", reptCode);

    if (rows.length > 0) {

        RepReportsViewRowImpl curRow = (RepReportsViewRowImpl) rows\[0\];

        BlobDomain blob = curRow.getReptFile();

        BufferedInputStream in = null;

        in = new BufferedInputStream(blob.getBinaryStream());

        return in;

    }

    return null;

}

and The calling function is like below (bold lines):

public void generatPDFReport(String repPath, HashMap param, OutputStream out) throws Exception

{

    System.out.println("generatPDFReport started successfully!");

  Connection conn = null;

  try

  {

    HttpServletResponse response = getResponse();

// ServletOutputStream out = response.getOutputStream();

    response.setHeader("Cache-Control", "max-age=0");

    response.setContentType("application/pdf");

    response.setHeader("Content-Disposition", "attachment; filename=out.pdf");

    ServletContext context = getContext();

    **InputStream fs = context.getResourceAsStream("/reports/" + repPath);   // \<\< FROM DSIK works fine**

// InputStream fs = downloadReportFile("arg1"); // <<< FROM DB NOT working showing blank white browser

    JasperReport template = (JasperReport) JRLoader.loadObject(fs);

    template.setWhenNoDataType(WhenNoDataTypeEnum.ALL\_SECTIONS\_NO\_DETAIL);

    conn = getConnection();

    JasperPrint print = JasperFillManager.fillReport(template, param, conn);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    JasperExportManager.exportReportToPdfStream(print, baos);

    out.write(baos.toByteArray());

    out.flush();

    out.close();

    FacesContext.getCurrentInstance().responseComplete();

  }

  catch (Exception jex)

  {

    jex.printStackTrace();

  }

  finally

  {  

    close(conn);

  }

    System.out.println("generatPDFReport ended successfully!");

}

I have added the exact same jasper libraries as I did for building the component

For the application using the component

pastedImage_23.png

pastedImage_24.png

Problem

In the calling application the jsf (containing a BTF holding a jsff holding the componenet), shows blank white page with no compoenets in it (even the filter value compoenets of the reprot.)

The server output is as below:

[07:07:49 AM] ---- Deployment finished. ----

Run startup time: 76512 ms.

[Application MISReportGenSample running on IntegratedWebLogicServer]

Target URL -- http://127.0.0.1:7101/MISReportGenSample-ViewController-context-root/faces/employeesReport.jsf

<org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl> <ViewHandlerImpl> <_isTimestampCheckEnabled> <Apache Trinidad is running with time-stamp checking enabled. This should not be used in a production environment. See the org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml>

<Feb 20, 2018, 7:07:56,160 AM PST> <Warning> <Socket> <BEA-000449> <Closing the socket, as no data read from it on 127.0.0.1:57,539 during the configured idle timeout of 5 seconds.>

<Feb 20, 2018, 7:07:56,161 AM PST> <Warning> <Socket> <BEA-000449> <Closing the socket, as no data read from it on 127.0.0.1:57,541 during the configured idle timeout of 5 seconds.>

<Feb 20, 2018, 7:07:56,161 AM PST> <Warning> <Socket> <BEA-000449> <Closing the socket, as no data read from it on 127.0.0.1:57,542 during the configured idle timeout of 5 seconds.>

<Feb 20, 2018, 7:07:56,162 AM PST> <Warning> <Socket> <BEA-000449> <Closing the socket, as no data read from it on 127.0.0.1:57,543 during the configured idle timeout of 5 seconds.>

<Feb 20, 2018, 7:07:56,163 AM PST> <Warning> <Socket> <BEA-000449> <Closing the socket, as no data read from it on 127.0.0.1:57,540 during the configured idle timeout of 5 seconds.>

Questions

Why can't I see any error in the WLS output ? Is there any log level I need to set ? If yes what is it?

What is the solution for this?

Thanks you

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2018
Added on Feb 20 2018
3 comments
312 views