Results 1 to 2 of 2
  1. #1
    jadeite100 is offline Member
    Join Date
    Dec 2009
    Rep Power

    Default could not load load from location:/test_subreport.jasper

    Hi All:

    Any help or hint is greatly appreciated it!!
    I am currently using IceFaces 1.8.2, Jsf 1.1, and JasperReport 3.5.2.
    I get the following error:
    net.sf.jasperreports.engine.JRException: Could not load object from location : /test_subreport.jasper
    The report test_report.jasper has a subreport called test_subreport.jasper. I placed both test_report.jasper and test_subreport.jasper in the directory "WEB-INF/reports/"

    public String testSearch() throws Exception
    Connection connection;
    FacesContext context = FacesContext.getCurrentInstance();
    HttpServletResponse response = (HttpServletResponse)context.getExternalContext(). getResponse();
    InputStream reportStream = context.getExternalContext().getResourceAsStream(" WEB-INF/reports/test_report.jasper");
    ServletOutputStream servletOutputStream = response.getOutputStream();
    ServletContext ctx = (ServletContext) FacesContext.getCurrentInstance().getExternalConte xt().getContext();
    String filepath = ctx.getRealPath("/WEB-INF/reports/");
    filepath = filepath = "/";
    String imagepath = ctx.getRealPath("/WEB-INF/images/test_logo.gif");

    HashMap parameterMap = new HashMap();

    parameterMap.put("SUBREPORT_DIR", filepath);
    parameterMap.put("Test Number", testNumber);
    parameterMap.put("Image Path", imagepath);

    Properties properties = new Properties();
    properties.load(context.getExternalContext().getRe sourceAsStream("WEB-INF/"));

    String driver = properties.getProperty("jdbc.driver");
    String jdbc_url = properties.getProperty("jdbc.url");
    String username = properties.getProperty("jdbc.username");
    String password = properties.getProperty("jdbc.password");
    connection = DriverManager.getConnection(jdbc_url, username, password);

    JasperRunManager.runReportToPdfStream(reportStream , servletOutputStream, parameterMap, connection);
    //byte[] reports = JasperRunManager.runReportToPdf(reportStream, parameterMap, connection);
    catch(Exception e)
    log.error("exception message:"+e.getMessage());

    return "success";

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: could not load load from location:/test_subreport.jasper

    Quote Originally Posted by jadeite100 View Post
    Any help or hint is greatly appreciated it!!
    Don't you think that after being a member for more than two years, you should know how to post code so that it retains its formatting?

    Here's a hint: FAQs

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Help Me, load in car number
    By TANKDS in forum New To Java
    Replies: 1
    Last Post: 02-06-2012, 11:35 PM
  2. How to load and view Jasper Report template
    By steiger in forum AWT / Swing
    Replies: 1
    Last Post: 12-28-2010, 12:08 AM
  3. How to load jasper report
    By anilkumar_vist in forum Advanced Java
    Replies: 0
    Last Post: 10-04-2010, 10:26 AM
  4. [something] load event
    By OmerHalit in forum Java Applets
    Replies: 2
    Last Post: 04-06-2010, 01:41 AM
  5. Load URL that contains spaces?
    By barkster in forum Java Applets
    Replies: 0
    Last Post: 01-30-2008, 10:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts