FileNotFoundException while I am using jasper report

后端 未结 4 1915
说谎
说谎 2021-01-06 19:10

I am trying to create Jasper Report in Liferay portlet but I am getting below error:

   Caused by: net.sf.jasperreports.engine.JRException: java.io.FileNotF         


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-01-06 19:46

    I think your .jasper file is not in your context path of application (Atleast the application is not finding it).

    Are you sure the /report folder is in build path?? If not, add it to build path.

    Otherwise try to use something like this JasperReport report = JasperCompileManager.compileReport("classpath:src/com/ztscorp/lms/reports/HibernateQueryDemoReport.jasper");

    try this,

    change

    JasperReport report = JasperCompileManager.compileReport("src/com/ztscorp/lms/reports/HibernateQueryDemoReport.jrxml");
    

    to

    JasperReport report = JasperCompileManager.compileReport(new File("").getAbsolutePath()+"src/com/ztscorp/lms/reports/HibernateQueryDemoReport.jrxml");
    

    Hope it helps,

    -Anuj

提交回复
热议问题