Jasper report renders is not the PDF file on the screen in ADF
Im getting Error : Error While Displaying Report Page : See Console for Details
I have all of the following Jars
(iText - 1). 2.1.7.js2
Jackson - core - 2.) 2.1.4
JasperReports - 3) 5.6.0
JasperReports - graphic - themes - 4.) 5.6.0
JasperReports - core - 5 converter.)
JasperReports - fonts - 6.) 5.6.0
JCommon - 7) 1.0.15
JFreeChart-8). 1.0.13
Error itself:
*java.lang.ClassCastException: net.sf.jasperreports.engine.export.DefaultExporterFilterFactory cannot be cast to net.sf.jasperreports.engine.export.ExporterFilterFactory*
at net.sf.jasperreports.engine.export.ExporterFilterFactoryUtil.getFilterFactory(Ex porterFilterFactoryUtil.java:53)
at net.sf.jasperreports.engine.JRAbstractExporter.createFilter(JRAbstractExporter.j ava:1136)
at net.sf.jasperreports.engine.JRAbstractExporter.initReport(JRAbstractExporter.jav a:726)
at net.sf.jasperreports.engine.export.JRGraphics2DExporter.initReport(JRGraphics2DE xporter.java:255)
at net.sf.jasperreports.engine.JRAbstractExporter.setCurrentExporterInputItem(JRAbs tractExporter.java:567)
at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportReportToGraphics2D (JRGraphics2DExporter.java:285)
at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportReport(JRGraphics2 DExporter.java:236)
at net.sf.jasperreports.view.JRViewer.paintPage(JRViewer.java:2121)
at net.sf.jasperreports.view.JRViewer$PageRenderer.paintComponent(JRViewer.java:227 1)
at javax.swing.JComponent.paint(JComponent.java:1054)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JViewport.paint(JViewport.java:731)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:585)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5226)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java: 1529)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1452)
at javax.swing.RepaintManager.paint(RepaintManager.java:1249)
at javax.swing.JComponent.paint(JComponent.java:1040)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:78)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:115)
at java.awt.Container.paint(Container.java:1967)
at java.awt.Window.paint(Window.java:3877)
at javax.swing.RepaintManager$3.run(RepaintManager.java:819)
at javax.swing.RepaintManager$3.run(RepaintManager.java:796)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:7 6)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:796)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:769)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:718)
at javax.swing.RepaintManager.access$1100(RepaintManager.java:62)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1677)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:7 6)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242 )
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150 )
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
My bean Code:
public class PortoflioListJasper {
public PortoflioListJasper() {
}
public String runReportAction() {
System.out.println("On ReportAction");
DCIteratorBinding empIter = (DCIteratorBinding) getBindings().get("*Iterator Name*");
System.out.println("On Iterator");
Integer var = (Integer) (empIter.getCurrentRow().getAttribute("Id"));
System.out.println("On Attribute");
Map m = new HashMap();
System.out.println("On Map EmpID");
m.put("name",var );// where employeeId is a jasper report parameter
System.out.println("On Map " +portfolioId);
try
{
runReport("Reporta.jasper", m);
}
catch (Exception e)
{
}
return null;
}
public BindingContainer getBindings()
{
return BindingContext.getCurrent().getCurrentBindingsEntry();
}
public Connection getDataSourceConnection(String dataSourceName)
throws Exception
{
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup(dataSourceName);
return ds.getConnection();
}
private Connection getConnection()
{
try
{
System.out.println("On Connection");
return getDataSourceConnection("*DataSource Name*");// datasource name should be defined in weblogic
}
catch (Exception e) {
System.out.println("On Catch");
e.printStackTrace();
return null;
}
}
public ServletContext getContext()
{
return (ServletContext)getFacesContext().getExternalContext().getContext();
}
public HttpServletResponse getResponse()
{
return (HttpServletResponse)getFacesContext().getExternalContext().getResponse();
}
public static FacesContext getFacesContext()
{
return FacesContext.getCurrentInstance();
}
public void runReport(String repPath, java.util.Map param) throws Exception
{
Connection conn = null;
try
{
HttpServletResponse response = getResponse();
System.out.println("Response : " +response);
ServletOutputStream out = response.getOutputStream();
response.setHeader("Cache-Control", "max-age=0");
response.setContentType("application/octet-stream");
ServletContext context = getContext();
InputStream fs = context.getResourceAsStream("/Reports/" + repPath);
System.out.println("Response : " +repPath);
System.out.println("Response : " +fs);
JasperReport template = (JasperReport) JRLoader.loadObject(fs);
System.out.println("Template : " +template);
template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
conn = getConnection();
JasperPrint print = JasperFillManager.fillReport(template, param, conn);
System.out.println("PDF" +print);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(print, baos);
System.out.println("PDF" +baos);
out.write(baos.toByteArray());
JasperViewer view = new JasperViewer(print,false);
view.setVisible(true);
System.out.println("Printed");
out.flush();
out.close();
FacesContext.getCurrentInstance().responseComplete();
}
catch (Exception jex)
{
jex.printStackTrace();
}
finally
{
close(conn);
}
}
public void close(Connection con)
{
if (con != null)
{
try
{
con.close();
}
catch (Exception e)
{
}
}
}
}
@
I want the report to display on the screen...
Can someone tell me where Im wrong. ?
IM I missing all jars. ?
Help, please...
dvohra21 Fusion Middleware Oracle Community Portal users group
Dear
Sorry I forgot to paste the code
The bean code is
package com.ash.view.backing; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.sql.Connection; import java.util.HashMap; import java.util.Map; import javax.faces.context.FacesContext; import javax.naming.Context; import javax.naming.InitialContext; import javax.servlet.ServletContext; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import javax.sql.DataSource; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum; import net.sf.jasperreports.engine.util.JRLoader; import oracle.adf.model.BindingContext; import oracle.adf.model.binding.DCIteratorBinding; import oracle.binding.BindingContainer; public class JasperBean { public String runCustomersReport() { // Add event code here... DCIteratorBinding empIter = (DCIteratorBinding) getBindings().get("CustomerView1Iterator"); String cusId = empIter.getCurrentRow().getAttribute("CustId").toString(); Map m = new HashMap(); m.put("CustId", cusId); try { runReport("CustomersList.jasper", m); } catch (Exception e) { } return null; } public String runSalesInvoiceReport() { // Add event code here... DCIteratorBinding sinvIter = (DCIteratorBinding) getBindings().get("SalesView1Iterator"); String sinvId = sinvIter.getCurrentRow().getAttribute("SalId").toString(); Map m = new HashMap(); m.put("SalId", sinvId); try { runReport("SalesInvoice.jasper", m); } catch (Exception e) { } return null; } public BindingContainer getBindings() { return BindingContext.getCurrent().getCurrentBindingsEntry(); } public Connection getDataSourceConnection(String dataSourceName) throws Exception { Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup(dataSourceName); return ds.getConnection(); } private Connection getConnection() throws Exception { return getDataSourceConnection("AshCMSConnDS"); } public ServletContext getContext() { return (ServletContext)getFacesContext().getExternalContext().getContext(); } public HttpServletResponse getResponse() { return (HttpServletResponse)getFacesContext().getExternalContext().getResponse(); } public static FacesContext getFacesContext() { return FacesContext.getCurrentInstance(); } public void runReport(String repPath, java.util.Map param) throws Exception { Connection conn = null; try { HttpServletResponse response = getResponse(); ServletOutputStream out = response.getOutputStream(); response.setHeader("Cache-Control", "max-age=0"); response.setContentType("application/pdf"); ServletContext context = getContext(); InputStream fs = context.getResourceAsStream("/reports/" + repPath); 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); } } public void close(Connection con) { if (con != null) { try { con.close(); } catch (Exception e) { } } } }
The servlet code is
package com.ash.view; import com.ash.model.AppModuleImpl; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.HashMap; import java.util.Locale; import java.util.Map; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.xml.JRXmlLoader; import oracle.jbo.client.Configuration; @WebServlet(name = "MultiReportServlet", urlPatterns = { "/multireportservlet" }) public class MultiReportServlet extends HttpServlet { private static final String CONTENT_TYPE = "text/html; charset=UTF-8"; public void init(ServletConfig config) throws ServletException { super.init(config); } protected Connection getConnection() { PreparedStatement st = null; String amDef = "com.ash.model.AppModule"; String config = "AppModuleLocal"; AppModuleImpl am = (AppModuleImpl ) Configuration.createRootApplicationModule(amDef, config); st = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0); Connection conn = null; try { conn = st.getConnection(); return conn; } catch (SQLException e) { } return null; } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String var0 = ""; String reportName = ""; try { reportName = request.getParameter("reportName"); } catch (Exception e) { e.printStackTrace(); } response.setContentType(CONTENT_TYPE); Map parameters = new HashMap(); parameters.put("format", "pdf"); parameters.put("WEBDIR", getServletContext().getRealPath("/")); parameters.put("REPORT_LOCALE", new Locale("ar")); if(reportName.equals("CustomersList")) { Object value1 = request.getParameter("value1"); parameters.put("p1", value1); } if(reportName.equals("SalesInvoice")) { Object value1 = request.getParameter("value1"); parameters.put("p1", value1); } Connection conn = null; InputStream is = null; try { conn = getConnection(); is = getServletContext().getResourceAsStream("/WEB-INF/reports/"+reportName+".jrxml"); response.setContentType("application/pdf"); response.addHeader("Content-Disposition", "attachment; filename="+reportName+".pdf"); JasperDesign jasperDesign = JRXmlLoader.load(is); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn); JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); conn.close(); } catch (Exception e) { e.printStackTrace(); } finally { closeConnection(conn); try { if(is !=null){ is.close(); } } catch (Exception localException1) { } } } protected static void closeConnection(Connection conn) { try { if(conn !=null){ conn.close(); } } catch (Exception ex) { // System.out.println("Developer Msg : Exception in printReport1Servlet.closeConnection()"); } } }
I use three files in lib jasper
iText - 2.1.7
JasperReports - 4.0.1
JasperReports-fonts - 4.0.1
This code displays the report in adobe reader only and in the browser like firefox after some adjustments in the browser.
Concerning
Tags: Java
Similar Questions
-
My office print 8600 ProPlus will not print pdf files sent from an iPad with ePrint.
My office print 8600 ProPlus will not print pdf files sent from an iPad with ePrint. I just get an error message when I go to the HP Eprint centre. It prints the address email of the coverage, but nothing else. The attachment is not sure that I can see. I tried to send an attachment from my Mac and worked well.
Thank you for your response and I am sorry for the delay to return to you. I tried save the Pages document in a Word document and send it to the printer using ePrint but it is even. That is to say the handout printed but not the attachment. However, when we removed the accompanying document and sent the attachment in its own it has worked well for we have managed to solve the problem. Thank you very much.
-
My C4280 printer does not print PDF files. Cannot understand it.
I fixed the problem by uninstalling the printer, then re-install. That seemed to do the trick. Thanks for your help though.
-
It can not open PDF files in IE 7 or IE 8.
It can not open PDF files in IE 7 or IE 8. I have to use firefox. This just started last week. Whenever I try to open a pdf file, IE freezes and no response.
Are you running IE 7 and IE - 8 on the same computer? If so, how?
Uninstall and re - install Adobe Reader should fix.
-
OfficeJet 6500 not print pdf files.
I had this problem for a while and really need help. My officejet 6500 not print pdf files. It gives me just a little "beep", gushes out a piece of paper and that's it! Prints everything else very well. Removed and installed Adobe updated software, but that did not help.
I found that a McAfee application has been interfering and causes the error. Removal of this application solves the problem.
-
Hello. I can not dellete pdf files. A message says it was used, but it is not in fact. What should I do?
Please make sure that the Windows preview pane is disabled, and then try to delete the file again.
Let me know how it goes.
Kind regards
Ana Maria
-
JUST RENEWED MY SUBSCRIPTION AND NOW I CAN NOT CONVERT PDF FILES TO WORD OR EXCEL.
I HAVE JUST RENEWED MY SUBSCRIPTION AND NOW I CAN NOT CONVERT PDF FILES TO WORD OR EXCEL. HE KEEPS ASKING TO SUBSCRIBE ME. THESE ARE MY NUMBERS #1 ORDER: AD017472393. ORDER #2: AD017476626. PLEASE PROCESS QUICKLY, I HAVE A LOT OF WORK TO DO
1-adobe PDF, Annual export (other languages) ORDER NUMBERS #1: AD017472393
Pack 2-adobe PDF, annual (other languages) ORDER #2: AD017476626
PLEASE UPDATE YOUR RECORDS SO I CAN CONTINUE TO WORK
Best regards, Elihu abderrahim
Hi elihue69552074,
I checked the status of account request has been Unauthorized help & is still pending.
I will recommend you to contact our customer team on Monday to get this problem resolved to contact customer service.
Kind regards
Nicos
-
I can't print a pdf file. I can print a word file, but not a pdf file. Can you help me?
A few things to try.
Go in Edition > Preferences > Documents and PDF/A mode set to 'never '.
Then go in Edition > Preferences > (improved) security and uncheck the box "enable mode at startup protected.
If this does not work, you can always try by selecting 'Print picture' in the Advanced Print dialog box.
-
Windows Internet Explorer
Can not read PDF files. Something has changed. Used to be able to read. Can't understand why.
Download a free pdf reader and try again
Foxit
http://soft2011.co.UK/PDF-reader.php
Sumatra
http://blog.Kowalczyk.info/software/sumatrapdf/free-PDF-reader.html
-
My HP DJ1050 does not print pdf files
My HP DJ 1050 PRINT SCANNER COPIER - does not print .pdf files
I've seen this before changing your printer properties for 'print picture' where worked with PDF files.
I hope this helps.
-
This started with 20 Firefox and persists with Firefox 21. It's never happened before. Everything is up-to-date. However, PDFs don't appear. Sometimes I see the bar indicating a load of progression and sometimes it of just the normal program PDF background, but no matter, he does not appear. What is happening with this?
Moreover, I will eventually switch to Chrome to view the PDF file as I can't make them work in Firefox.
Thank you very much. That seems to work. What a shame the preview version of Firefox is not longer functional!
-
Acrobat, does not display PDF files correctly in the browser
This seems to happen only on chrome when displayed in the browser of the graphics, especially the text appears incorrectly, or in this case at all. You can see that the financial 'Fi' is missing. It is a major problem because most of the people who visit the site hit the download and the PDF file automatically opens in the browser. Is there any solution for this? Not bad I exported in Indesign? Fonts should be returned in an object before you export it in PDF format (this is the galley)?
BUT a quick fix is to download the PDF file, display in the browser, then refresh the page and display all fonts. Weird. It is a step that many will miss.
This is what it looks like when downloaded and played in acrobat. Notice the thicker fonts
You probably view the PDF file in the viewer of PDF from Google Chrome and NOT Adobe's PDF Viewer.
1. check your plug-ins by going to:
chrome://plugins
2. go outside viewer of PDF of Chrome.
3. If you see (active), then you use the viewer of PDF of Chrome.
Missing in many ways for the feature. Fonts is one of them.
4. you can disable
5. then go to the the list for Adobe Reader
Adobe PDF plugin for Firefox and Netscape
6. then turn it back on.
7 fact
-
When I click on print, a progress bar is displayed and 'progressing' through 5 pages of a pdf file. The printer starts to get a restless and I get a beep of the printer that it's done. But nothing came out of the printer! A few seconds later, a blank piece of paper is slowly ejected from the printer.
NOTE: The printer is able to print pdf files - No. Help!
DETAILS of zero = zero response
Version of Windows... Acrobat version... Printer brand & model and driver version... at least
-
New OfficeJet Pro 8620 does not print PDF files
I have a brand new 8620 and I use Windows 7. My printer prints a few PDFs but not most other PDF documents. I am using Acrobat Reader XI. The printer will print from MS Office.
HELP, please!
Hello! Welcome to the @lmel forums
I have a few ideas that come to mind, I read the issue you're having with printing of PDF files. They are here!
1. try to resave the PDF files that do not print and then try printing again.
2. update of Adobe:
Select help - search for updates. If a new update is available, it installs automatically.
Once installed, you can restart a computer.
Then try to print the PDF file.
http://helpx.Adobe.com/Acrobat/KB/troubleshoot-PDF-printing-Acrobat-Reader.html3. run the print and scan the doctor. This diagnostic tool will check for all conflicts that may be causing the problem. The tool will show you a report at the end. If there is a problem that the tool could not fix, you will notice it in the results.
4. uninstalling the printer software
Restart the PC
Reinstall the printer: HP Officejet Pro 8620 e-all-in-One Printer series full feature software and drivers
That should do the trick! Keep me abreast of the results!
Have a great Wednesday
-
No error message, no charge. Updated V29.0 to update this morning. OS X 10.6.8.
Hi gbilodeau,
There was a problem with printing, but look is not one. In order to deepen the study can you please include the following:- An example of a pdf file that does not appear in the pdf.js file
- What version of 29? 29.0.1?
Thank you, I look forward to your response.
Maybe you are looking for
-
my laptop repeat myself that ststring.dll is missing when I turn it on
my laptop keeps saying that ststring.dll is missing when I turn it on what should I please
-
Printer, not printing not all
Hello, this is my first time here, so my apologies if I don't understand quite right the first time. When I try to print a document, my printer does not print. It turns on and takes the paper in, but it is empty. I uninstalled and reinstalled and I
-
I can't turn my computer desk in a "WiFi Hotspot"
My computer, a desktop HP Windows 7 64 bit Home Premium computer, doesn't have the option "Set up a Wi - Fi connection" in the "network and sharing Center." Various videos that I looked and the articles I've read all have this classified as option 5
-
Windows Search service stopped, will not start! Help!
Operating system: Win7 HP 64 x Recently, I noticed that when I open the Start Menu and type in the search bar, no file or folder won't show upward, when they came the night before. I checked my services and the Windows Search service is stopped. I'm
-
Best way to hide the writing on a fixed object in static images (tripod)?
I have a sequence of two cameras multicam, a cam is a wide shot, the other cam is close to the top. All images taken on a tripod, so the camera shots are all static. In the images captured by each cam, there is a stationary object on a table in the b