Situation:
You have a requirement to export charts and dashboards using Chrome in headless browser mode. You've downloaded Chrome and verified it runs correctly but even after configuring it in js.config.properties file it's still not being picked up and the following error message is displayed consistently:
net.sf.jasperreports.engine.JRRuntimeException: Chrome and/or PhantomJS not properly configured for server side rendering (Error UID: 48538715-f3c7-4834-803d-38275330109a) com.jaspersoft.jasperserver.remote.exception.ExportExecutionRejectedException: net.sf.jasperreports.engine.JRRuntimeException: Chrome and/or PhantomJS not properly configured for server side rendering at com.jaspersoft.jasperserver.remote.services.impl.ReportExecutorImpl.exportReport(ReportExecutorImpl.java:202) at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl.generateReportOutput(RunReportServiceImpl.java:1162) at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl.executeExport(RunReportServiceImpl.java:615) at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl$2.run(RunReportServiceImpl.java:507) at com.jaspersoft.jasperserver.api.logging.util.LoggableExecutorService$1.run(LoggableExecutorService.java:84) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
You've verified that js.config.properties values are correct, for example:
chrome.path=/usr/bin/chromium-browser
Solution:
The js.config.properties value may be not picked up or gets ignored during the instantiation of the rendering engine. We could force the value for the property without having to delve into js.config.properties file but instead define it on the bean level in applicationContext.xml:
In your applicationContext.xml, locate the following part (lines 1430 in version 8.0.2): <property name="propertiesMap"> <props> <prop key="net.sf.jasperreports.chrome.enabled">#{!'${chrome.path:}'.trim().isEmpty()}</prop> <prop key="net.sf.jasperreports.chrome.executable.path">${chrome.path:}</prop> <prop key="net.sf.jasperreports.chrome.page.timeout">#{'${chrome.page.timeout:}'.trim().isEmpty() ? 150000 : (T(Integer).parseInt('${chrome.page.timeout:}'.trim()) * 1000)}</prop> <prop key="net.sf.jasperreports.chrome.argument.enable-logging">stderr</prop> </props> </property> Change these properties: <prop key="net.sf.jasperreports.chrome.enabled">#{!'${chrome.path:}'.trim().isEmpty()}</prop> <prop key="net.sf.jasperreports.chrome.executable.path">${chrome.path:}</prop> to: <prop key="net.sf.jasperreports.chrome.enabled">true</prop> <prop key="net.sf.jasperreports.chrome.executable.path">/usr/bin/chromium-browser</prop>
Save and restart the tomcat. If your browser is still not instantiated after this, check the following:
- user has access to the chromium browser binary
- user has correct execute permission
- user can run chromium-browser from the command line using a command such as this:
chrome --headless --disable-gpu --print-to-pdf https://www.chromestatus.com/
If you start getting different errors than "Chrome and/or PhantomJS not properly configured for server side rendering " then your Chromium hsa been started by execution failed further and errors need to be troubleshot based on the new error message.
Recommended Comments
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