Getting NullPointerException when trying to get the component report json output from Java
I create a component report and access it by http://localhost:4502/etc/reports/my-component-report.html. I can also get json output by http://localhost:4502/etc/reports/my-component-report/jcr:content/report.data.json.
I try to get this json output in Java and then to generate the excel file. However, I get the NullPointerException, see errors below:
GET /bin/excelreportservlet HTTP/1.1] com.day.cq.reporting.servlets.DataServlet Could not create report for report '/etc/reports/ryad-test-component-SECTION/jcr:content/report'
GET /bin/excelreportservlet HTTP/1.1] com.day.cq.reporting.servlets.DataServlet Stacktrace:
java.lang.NullPointerException: null
at com.day.cq.reporting.impl.cache.CacheImpl$CacheKey.toString(CacheImpl.java:77)
at com.day.cq.reporting.impl.cache.CacheImpl$CacheKey.hashCode(CacheImpl.java:64)
at org.apache.commons.collections.map.AbstractHashedMap.hash(AbstractHashedMap.java:373)
at org.apache.commons.collections.map.AbstractHashedMap.getEntry(AbstractHashedMap.java:433)
at org.apache.commons.collections.map.LRUMap.get(LRUMap.java:174)
at com.day.cq.reporting.impl.cache.CacheImpl.get(CacheImpl.java:242)
My code:
HttpServletRequest req = requestResponseFactory.createRequest("GET","/etc/reports/my-component-report/jcr:content/report.data.json");
ByteArrayOutputStream out = new ByteArrayOutputStream();
HttpServletResponse resp = requestResponseFactory.createResponse(out);
Writer writer = response.getWriter();
requestProcessor.processRequest(req, resp, request.getResourceResolver());
String jsonString = out.toString();
Above code works fine when the URL is "/etc/reports/my-component-report.-1.json".
Does anyone know how to get report json (/etc/reports/my-component-report/jcr:content/report.data.json) output in Java?
Thanks in advance for any information.