Results 1 to 2 of 2
- 03-27-2012, 04:33 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 13
- Rep Power
- 0
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
{
try
{
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/config.properties"));
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");
Class.forName(driver);
connection = DriverManager.getConnection(jdbc_url, username, password);
JasperRunManager.runReportToPdfStream(reportStream , servletOutputStream, parameterMap, connection);
//byte[] reports = JasperRunManager.runReportToPdf(reportStream, parameterMap, connection);
connection.close();
response.setContentType("application/pdf");
servletOutputStream.flush();
servletOutputStream.close();
}
catch(Exception e)
{
log.error("exception message:"+e.getMessage());
}
return "success";
}
- 03-27-2012, 11:43 AM #2
Re: could not load load from location:/test_subreport.jasper
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Help Me, load in car number
By TANKDS in forum New To JavaReplies: 1Last Post: 02-06-2012, 10:35 PM -
How to load and view Jasper Report template
By steiger in forum AWT / SwingReplies: 1Last Post: 12-27-2010, 11:08 PM -
How to load jasper report
By anilkumar_vist in forum Advanced JavaReplies: 0Last Post: 10-04-2010, 10:26 AM -
[something] load event
By OmerHalit in forum Java AppletsReplies: 2Last Post: 04-06-2010, 01:41 AM -
Load URL that contains spaces?
By barkster in forum Java AppletsReplies: 0Last Post: 01-30-2008, 09:40 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks