I'm trying to get the JR-PrintServer up and running, but run into some problems:
When I try to open the app directly via "http://192.168.2.20:8080/jrpserver/" or call via APEX ... Tomcat throws always the following error:
java.lang.NullPointerException
at java.io.File.<init>(Unknown Source)
...
The message gives no indication if this is a default error because thats the app wants some required parameters or if its a in-depth JAVA/Tomcat problem. (tried also with Tomcat 7 and JAVA 7)
Servers running (all on the same host):
Windows 2012 R2
Oracle 11g
APEX 5.0.3
Tomcat 8
JAVA 8
Current configuration:
Tomcat: deployed "jrpserver.war"
Tomcat: configured report path under "jrpserver/WEB-INF/classes/net/sf/jasperreports/printserver" (complete restart)
APEX: configured reporting server under ADMIN
APEX: created Report Query ... generated print URL: f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=test-invoice (static Jasper Report sample exists under the report path)
APEX: created Report Layout with Generic Columns and referenced test-invoice.jasper
I would appreciate to get some ideas.
BR
Sebastian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
first I have two questions: Which version of JR PrintServer are you using?
And: What's the complete Java Stacktrace?
I assume that the NullPointerException is thrown because the Report Layout does not contain a valid file name to the .jasper file.
But without the complete stacktrace it's hard to say.
Your server with Java 8 and Tomcat 8 should work well.
I guess you're a native German speaker so this document may also help you:
Yes of course, I've worked through your german document. There where some good hints.
I'm using the 2.5.1 of JR Printserver.
Here is my actual stack dump:
Error
The following error occured during Report creation:
java.lang.NullPointerException
at java.io.File.<init>(Unknown Source)
at net.sf.jasperreports.engine.util.JRResourcesUtil.resolveFile(JRResourcesUtil.java:292)
at net.sf.jasperreports.repo.DefaultRepositoryService.getInputStream(DefaultRepositoryService.java:102)
at net.sf.jasperreports.repo.InputStreamPersistenceService.load(InputStreamPersistenceService.java:45)
at net.sf.jasperreports.repo.DefaultRepositoryService.getResource(DefaultRepositoryService.java:149)
at net.sf.jasperreports.repo.SerializedObjectPersistenceService.load(SerializedObjectPersistenceService.java:48)
at net.sf.jasperreports.repo.SerializedReportPersistenceService.load(SerializedReportPersistenceService.java:40)
at net.sf.jasperreports.repo.DefaultRepositoryService.getResource(DefaultRepositoryService.java:149)
at net.sf.jasperreports.repo.RepositoryUtil.getResourceFromLocation(RepositoryUtil.java:144)
at net.sf.jasperreports.printserver.JRWorker.loadReport(JRWorker.java:109)
at net.sf.jasperreports.printserver.JRWorker.work(JRWorker.java:212)
at net.sf.jasperreports.printserver.PrintServlet.processRequest(PrintServlet.java:93)
at net.sf.jasperreports.printserver.PrintServlet.doGet(PrintServlet.java:113)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1102)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:788)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1485)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
BR
Sebastian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, now with the complete stacktrace it's clear:
The exception is thrown when JR PrintServer tries to load the jasper file from the reports path.
But the content of the Report Layout which should contain the (relative) file name of the jasper file is (or evaluates to) null.
This happens for example for the following Report Layout:
<template><report><value></value></report><!-- Other stuff may follow --></template>
So, the value of /template/report/value is null. And this null causes then the NullPointerException.
To analyse futher: Can you provide the Report Layout that you are using?
Regards,
Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
<template><xmlLocale><value>de_DE</value></xmlLocale><xmlTimeZone><value>+09:00</value></xmlTimeZone><report><value>ew-test.jasper</value></report><dateFormat><value><![CDATA[yyyy MM dd HH mm ss SSS]]></value></dateFormat></template>
Looking at your Report Layout and your configuration.xml JR PrintServer should look for your report file as "c:\app\MYREPORTS\ew-test.jasper".
It's strange that we get a NullPointerException because in your Report Layout /tempate/report/value is "ew-test.jasper".
If JR PrintServer would NOT find the file it would throw a ResourceNotFoundException (or similiar) exception.
So, I still think that - for what ever reason - the Report Layout that JR PrintServer gets is somehow wrong.
We will definitly find out what's wrong, but we'll have to do some further tests.
First, access the following URL to see the status of your JR PrintServer:
This will generate an HTML page with lots of information - take a look at the upper part were the configured Reports Path are reported and tested, if they can be accessed.
Here paste some sample XML data into the first text area. (You may use the content of the sample XML from APEX.)
Then paste your XML of the Report Layout (i.e. template) into the second text area.
(Delete the existing content of this text area - it contains initially a very complex empty dummy template.
You can take a look at this - it gives you an idea what you can do with the Report Layout/template...)
Then click on the Submit button to call JR PrintServer.
Now, we have initiated an HTTP-POST call just as APEX would do it - but here we know exactly what gets submitted to JR PrintServer.
Let's see if this works.
Additionally you may activate the logging. In .../jrpserver/WEB-INF/classes you will find a file called "logging.properties".
Here you can change the log level of some classes, for example you can uncomment (remove the hash) the following lines:
Then shutdown/start Tomcat, execute a report run and take a look into the jrpserver.log file(s) in Tomcats logs directory.
Here you can see exactly what JR PrintServer gets from its client (APEX or test.html).
Regards,
Michael
Last edit: Michael 2016-06-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
now with test.html we see that the template parameter in fact contains "ew-test.jasper" in /template/report/value.
The next question is: Is it also there when you execute the report from APEX? (The same stuff should be logged.)
So, in your test with test.html the report file could be loaded and executed.
Then you only get an empty PDF - this is the case because your report uses a SQL query as its Data Source and hence needs a SQL Connection to query.
But JR PrintServer does not provide a SQL Connection to the report - it provides a Data XML Document, so your report should NOT use SQL as its query language but xPath to "query" the XML.
You can change this on JSS when you right click on the report node and select "Dataset and Query...".
For your test report you may enter here as Query the xPath expression "/" (just a slash to "produce" one row).
Regards,
Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now to your button: make sure that the button submits the page so that you get into the Page Processing of your page.
There you should define a PL/SQL process. I would code it this way:
declare
l_blob blob;
begin
l_blob := apex_util.get_print_document(
p_application_id => :APP_ID, /* Never hard code an application id */
p_report_query_name => 'ew-test');
--
jrpserver.download(l_blob, 'ew-test', jrpserver.pdf /* Better to use the defined constant */);
apex_application.stop_apex_engine;
end;
Now when you click the button the page should get submitted and as a reply you should get a File Save dialog or your browser may be able to display the produced PDF directly.
I suppose that you get the JSON error because for whatever reason your button did not submit. Moreover, don't use a Dynamic Action that executes PL/SQL code on button click here to download the document - unfortunately, this does not work (your APEX log looks like that).
Regards,
Michael
Last edit: Michael 2016-06-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good day All
I'm trying to get the JR-PrintServer up and running, but run into some problems:
When I try to open the app directly via "http://192.168.2.20:8080/jrpserver/" or call via APEX ... Tomcat throws always the following error:
The message gives no indication if this is a default error because thats the app wants some required parameters or if its a in-depth JAVA/Tomcat problem. (tried also with Tomcat 7 and JAVA 7)
Servers running (all on the same host):
Current configuration:
I would appreciate to get some ideas.
BR
Sebastian
Hi Sebastian,
first I have two questions: Which version of JR PrintServer are you using?
And: What's the complete Java Stacktrace?
I assume that the NullPointerException is thrown because the Report Layout does not contain a valid file name to the .jasper file.
But without the complete stacktrace it's hard to say.
Your server with Java 8 and Tomcat 8 should work well.
I guess you're a native German speaker so this document may also help you:
https://www.doag.org/formes/pubfiles/6352032/docs/Publikationen/DOAGNews/2014/05-14/2014-05-News-Michael-Schmid-Apex-und-JasperReports---ein-starkes-Team-mit-dem-JR-PrintServer.pdf
Regards,
Michael
Hi Michael
Yes of course, I've worked through your german document. There where some good hints.
I'm using the 2.5.1 of JR Printserver.
Here is my actual stack dump:
BR
Sebastian
Hi Sebastian,
OK, now with the complete stacktrace it's clear:
The exception is thrown when JR PrintServer tries to load the jasper file from the reports path.
But the content of the Report Layout which should contain the (relative) file name of the jasper file is (or evaluates to) null.
This happens for example for the following Report Layout:
So, the value of /template/report/value is null. And this null causes then the NullPointerException.
To analyse futher: Can you provide the Report Layout that you are using?
Regards,
Michael
Hi Michael
Here is some of my current config:
Report Layout:
Report Query:
Report Path (jrpserver\web-inf\classes\configuration.xml):
BR
Sebastian
Hi Sebastian,
thanks for the additional infos.
Looking at your Report Layout and your configuration.xml JR PrintServer should look for your report file as "c:\app\MYREPORTS\ew-test.jasper".
It's strange that we get a NullPointerException because in your Report Layout /tempate/report/value is "ew-test.jasper".
If JR PrintServer would NOT find the file it would throw a ResourceNotFoundException (or similiar) exception.
So, I still think that - for what ever reason - the Report Layout that JR PrintServer gets is somehow wrong.
We will definitly find out what's wrong, but we'll have to do some further tests.
First, access the following URL to see the status of your JR PrintServer:
http://192.168.2.20:8080/jrpserver/info
This will generate an HTML page with lots of information - take a look at the upper part were the configured Reports Path are reported and tested, if they can be accessed.
Then, let's start a JR PrintServer run without APEX.
Access: http://192.168.2.20:8080/jrpserver/test.html
Here paste some sample XML data into the first text area. (You may use the content of the sample XML from APEX.)
Then paste your XML of the Report Layout (i.e. template) into the second text area.
(Delete the existing content of this text area - it contains initially a very complex empty dummy template.
You can take a look at this - it gives you an idea what you can do with the Report Layout/template...)
Then click on the Submit button to call JR PrintServer.
Now, we have initiated an HTTP-POST call just as APEX would do it - but here we know exactly what gets submitted to JR PrintServer.
Let's see if this works.
Additionally you may activate the logging. In .../jrpserver/WEB-INF/classes you will find a file called "logging.properties".
Here you can change the log level of some classes, for example you can uncomment (remove the hash) the following lines:
Then shutdown/start Tomcat, execute a report run and take a look into the jrpserver.log file(s) in Tomcats logs directory.
Here you can see exactly what JR PrintServer gets from its client (APEX or test.html).
Regards,
Michael
Last edit: Michael 2016-06-16
Good morning Michael
The report path is configured correctly and system services has full access rights.
UAC temp. deactivated.
Tomcat started with "as admin".
Here is my log output for the manual test through "test.html":
Just got an empty PDF (not my Jasper Report which includes some static dummy text).
BR
Sebastian
Hi Sebastian,
now with test.html we see that the template parameter in fact contains "ew-test.jasper" in /template/report/value.
The next question is: Is it also there when you execute the report from APEX? (The same stuff should be logged.)
So, in your test with test.html the report file could be loaded and executed.
Then you only get an empty PDF - this is the case because your report uses a SQL query as its Data Source and hence needs a SQL Connection to query.
But JR PrintServer does not provide a SQL Connection to the report - it provides a Data XML Document, so your report should NOT use SQL as its query language but xPath to "query" the XML.
You can change this on JSS when you right click on the report node and select "Dataset and Query...".
For your test report you may enter here as Query the xPath expression "/" (just a slash to "produce" one row).
Regards,
Michael
Hello Michael
Sorry for the delay - holidays! ;-)
Okay that was a good no-data idea for the report. Fixed.
Now I can successfully print a report through the Shared-Components/Report Queries/ew-test/Test Report. Got a valid PDF. Happy it works!
Further I tried to get this reproducable with PL/SQL code. But got a error message from my browser:
This procedure would be called with a button click:
APEX debug log:
BR
Sebastian
Hi Sebastian,
nice to hear that we are moving forward.
Now to your button: make sure that the button submits the page so that you get into the Page Processing of your page.
There you should define a PL/SQL process. I would code it this way:
Now when you click the button the page should get submitted and as a reply you should get a File Save dialog or your browser may be able to display the produced PDF directly.
I suppose that you get the JSON error because for whatever reason your button did not submit. Moreover, don't use a Dynamic Action that executes PL/SQL code on button click here to download the document - unfortunately, this does not work (your APEX log looks like that).
Regards,
Michael
Last edit: Michael 2016-06-28
Ups have forgotten the Tomcat log - still looks good? But the file save dialog not comes up ...
BR
Sebastian
Yes, this Tomcat log looks just fine.
Please see also my further comments above.
Last edit: Michael 2016-06-28