java - JasperPrint opens a dangerous tray icon on Mac that may kill Tomcat -


i have problem accounting web application enhanced printing using jasper reports. being accounting application, has been decided being deployed accountant's workstation mac book pro laptop regular backups of mysql database. installing on serious server machine out of question.

the user has java8 / tomcat8 stack , runs server command line. application worked fine until now.

every time user prints report using jasper (code later), tray icon open displaying java control panel icon.

java tray icon

clicking on icon nothing, annoying. see window (from finder top bar) called bootstrap. no menu action except exit available. clicking exit kills tomcat server.

code follows:

@override public byte[] generatereportpdf(list<?> dtos, string jasperfilename, locale locale) {     bytearrayoutputstream bytearrayoutputstream = new bytearrayoutputstream();     try     {         jasperprint jasperprint = createjasperprint(dtos, jasperfilename, locale);          jrpdfexporter exporter = new jrpdfexporter();         simplepdfexporterconfiguration config = new simplepdfexporterconfiguration();         config.setencrypted(true);         config.set128bitkey(true);         config.setownerpassword(psw_crypt_pdf);         config.setpermissions(pdfwriter.allow_printing);          exporter.setexporterinput(new simpleexporterinput(jasperprint));         exporter.setexporteroutput(new simpleoutputstreamexporteroutput(bytearrayoutputstream));         exporter.setconfiguration(config);         exporter.exportreport();     }     catch (exception e)     {         logger.error(e.getmessage(), e);         throw new runtimeexception("pdf error", e);     }         {         try         {             bytearrayoutputstream.close();         }         catch (ioexception e)         {             logger.error(e.getmessage(), e);         }     }      return bytearrayoutputstream.tobytearray(); }  private jasperprint createjasperprint(list<?> dtos, string jasperfilename, locale locale) throws jrexception {     classloader classloader = thread.currentthread().getcontextclassloader();     inputstream inputstream = classloader.getresourceasstream(jasper_report_folder + jasperfilename + ".jrxml");     jasperdesign jasperdesign = jrxmlloader.load(inputstream);     jasperreport jasperreport = jaspercompilemanager.compilereport(jasperdesign);     //jasperreport jasperreport = (jasperreport) jrloader.loadobject(classloader.getresource(jasper_report_folder + jasperfilename + ".jasper"));      // set mas pages , timeout     jasperreport.setproperty(maxpagesgovernor.property_max_pages_enabled, "true");     jasperreport.setproperty(maxpagesgovernor.property_max_pages, "50");     jasperreport.setproperty(timeoutgovernor.property_timeout_enabled, "true");     jasperreport.setproperty(timeoutgovernor.property_timeout, "60000");     jasperreport.setproperty("net.sf.jasperreports.default.font.name", "dejavu sans");     jasperreport.setproperty("net.sf.jasperreports.default.pdf.embedded", "true");     jasperreport.setproperty("net.sf.jasperreports.default", "dejavu sans");      jrbeancollectiondatasource jrdatasource = new jrbeancollectiondatasource(dtos, false);      hashmap<string, object> parameters = new hashmap<>();     parameters.put(jrparameter.report_locale, locale);     return jasperfillmanager.fillreport(jasperreport, parameters, jrdatasource); } 

the question is

why happen on mac? how prevent tray icon appearing? developers running either windows 10 or suse linux hosts, , not having issue on our machines, not on sit environment running windows 7.

jasperreports uses awt things text measurements , image processing. when java process runs in graphical environment (i.e. process of user logged desktop environment session), awt classes use environment graphical processing default. mac os interprets graphical processing evidence process has kind of ui, , includes java process application in taskbar.

if don't want happen, can force java process headless awt mode adding -djava.awt.headless=true java options in tomcat. result in awt using headless graphical environment implementation instead of desktop environment.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -