3 Replies Latest reply: Aug 4, 2009 8:48 AM by PhHein RSS

    invalid name of printservice

      I had jasper report code written in java 1.4 as the following and works perfect.

      JasperReport report = JasperManager.loadReport(getClass().getResourceAsStream("/....../printEnvelope.jasper") );
      Map parameters = new HashMap();
      JasperPrint print = JasperFillManager.fillReport(report, parameters, envelope_source);

      JRPrintServiceExporter envelop_exporter = new JRPrintServiceExporter();
      PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet ();
      envelop_exporter.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, pras);
      envelop_exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);
      envelop_exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.TRUE);
      envelop_exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);

      I upgrade it to java 1.6 now, 4 computers runs without any problem. But one of my computer can't print it anymore.
      it give me error:
      net.sf.jasperreorts.engine.JRException: java.awt.print.Printerexception: invalid name of printService.
      This computer could print when I was using java 1.4

      Anybody has any idea why the exception occured? and how to solve it? thanks
        • 1. Re: invalid name of printservice
          Please take a look at: http://bugs.sun.com/view_bug.do?bug_id=6445576
          The error message in the case of 6445576 seems to appear due to insufficient memory. Does the machine with the issue have less memory than the other machines? If so, perhaps you can try increasing the heap size for the program and see if it helps.

          Of course, the reason could be something else too; can you post the entire stacktrace here? (If your program is a standalone application, you can try 'java -verbose ...' and see if the output provides any clue.
          • 2. Re: invalid name of printservice
            I had the same exception in one of our applications and it was solved by adding the bold line before the printDialog() call in the code snippet below:

            PrinterJob printerJob = PrinterJob.getPrinterJob();
            PageFormat page = printerJob.defaultPage();
            if (printerJob.printDialog()) {
            • 3. Re: invalid name of printservice
              stephandamen , welcome and thanks for the contribution. But please don't post to years old threads. Locking.