2005 IR Help Posted August 25, 2006 Share Posted August 25, 2006 By: sunxufeng - sunxufeng No printer found error 2004-03-25 00:21 Hi all, I met a problem when using JasperReport. This is my code : 46. while (true) { 47. Thread.sleep(1000); 48. JasperPrintManager.printReport(jasperPrint, false); 49. i++; 50. System.out.println(i); 51. } After loop about 1000 times, an exception will be thrown. One of the output is as following: 1 2 3 . . . 989 java.awt.print.PrinterException: No printer found. at sun.awt.windows.WPrinterJob._startDoc(Native Method) at sun.awt.windows.WPrinterJob.startDoc(WPrinterJob.java:1021) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1069) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1011) at dori.jasper.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:239) at dori.jasper.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:138) at dori.jasper.engine.JasperPrintManager.printPages(JasperPrintManager.java:389) at dori.jasper.engine.JasperPrintManager.printReport(JasperPrintManager.java:280) at test.report.main(report.java:48) NESTED BY : java.awt.print.PrinterException: No printer found. at sun.awt.windows.WPrinterJob._startDoc(Native Method) at sun.awt.windows.WPrinterJob.startDoc(WPrinterJob.java:1021) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1069) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1011) at dori.jasper.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:239) at dori.jasper.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:138) at dori.jasper.engine.JasperPrintManager.printPages(JasperPrintManager.java:389) at dori.jasper.engine.JasperPrintManager.printReport(JasperPrintManager.java:280) at test.report.main(report.java:48) NESTED BY : dori.jasper.engine.JRException: Error printing report. at dori.jasper.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:244) at dori.jasper.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:138) at dori.jasper.engine.JasperPrintManager.printPages(JasperPrintManager.java:389) at dori.jasper.engine.JasperPrintManager.printReport(JasperPrintManager.java:280) at test.report.main(report.java:48) Caused by: java.awt.print.PrinterException: No printer found. at sun.awt.windows.WPrinterJob._startDoc(Native Method) at sun.awt.windows.WPrinterJob.startDoc(WPrinterJob.java:1021) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1069) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1011) at dori.jasper.engine.print.JRPrinterAWT.printPages(JRPrinterAWT.java:239) ... 4 more i use jdk1.4.2 and Adobe PDF virtual printer and jasperreports-0.5.0,the same as jasperreports-0.5.2 Thanks, Gerald 2004-03-25 By: Teodor Danciu - teodord RE: No printer found error 2004-03-25 11:28 Hi, I don't think this is related to JasperReports. You are trying to print a document 1000 times in a loop. Don't you think the spooler gets clogged, even if it is about a virtual printer. Try doing the same thing and print some other document 1000 times. I hope this helps. Teodor By: sunxufeng - sunxufeng RE: No printer found error 2004-03-25 19:35 Hi, I don't think this is related to the document. The actual situation is we have an application programme responsible for printing which is the APPLET embeded in IE. Users prints all kinds of documents with this program ( APPLET), but after using for some time, IE will come up against the problem of "invalid/illegal operation" . We have excluded any other possibility and finally found that the error is due to the JasperPrintManager.printReport(), and found the function has memory leak. It seems the bug(http://developer.java.sun.com/developer/bugParade/bugs/4737016.html, http://developer.java.sun.com/developer/bugParade/bugs/4657463.html) of the jre has something to do with this problem. We have tried the jdk1.4.2_04 but still can not solve the bug. Supposed the error is really because of the jre, is there any other function we can use to steer clear of it? or any other substitute solutions? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now