Run jasper report from servlet

0

Dears,

I have nested java project which use jasper report to generate some reports. The project structure is like this:

-WebProject (web application)

-JasperProject(java application)

I added the JasperProject to build path. I test the JasperProject and it works perfect.

When I tried to test the same functinality from WebProject it throw this exception:


May 18, 2015 8:33:56 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [sd.nctr.e15.gui.AJAX_Data] in context with path [/E15] threw exception
java.lang.NullPointerException
        at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)
        at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
        at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:517)
        at sd.nctr.e15.generator.JasperReportFill.filler(JasperReportFill.java:89)
        at sd.nctr.e15.generator.access.ReceiptData.generate(ReceiptData.java:152)
        at sd.nctr.e15.gui.IssuingReceipt.generateE15(IssuingReceipt.java:256)
        at sd.nctr.e15.gui.AJAX_Data.doPost(AJAX_Data.java:309)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)

I tried to make the JasperProject withen WebProject as one project but the same exception. My question is: Is there any problem the Jasper report to work from Web Application or from Servlet??

a.merghani's picture
Joined: May 19 2015 - 12:42am
Last seen: 4 years 8 months ago

4 Answers:

0

Dears all,

Thanks to all for your replies After painfull tracing of the peroblem, finally, I solved the prolem. It was casued by conflict in the included library in the WebProject. There was 2 lib for jasper with deff version.

regards

a.merghani's picture
Joined: May 19 2015 - 12:42am
Last seen: 4 years 8 months ago
0

As per my knowledge, it works in web projects as well. I suspect, it is not finding the template to fill. Where you have kept the template?

abc.hegde's picture
166
Joined: Apr 1 2015 - 4:02am
Last seen: 8 months 2 weeks ago
0

Thanks for your reply. The template kept in the JasperProject. As mentioned before, I have nested projects. I have Web application that call JasperProject

to do the generation. Again, it works within the JasperProject which is stand alone java application.

 

a.merghani's picture
Joined: May 19 2015 - 12:42am
Last seen: 4 years 8 months ago
0

You probably didn't setup the web.xml correctly.

There also should be a "caused by" clause further down your log. Check what it says.

hozawa's picture
56222
Joined: Apr 24 2010 - 4:31pm
Last seen: 7 months 1 week ago
Feedback