Jump to content

taysay

Members
  • Posts

    3
  • Joined

  • Last visited

taysay's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi DNV Srikanth and the House Thanks a bunch, Though I got hold of my challenge which I believe it was due to impatience you know some times we expect text book examples to work out of the box, It was throwing a null pointer @ so I used IO classes to read it the .jasper file InputStream reportStream = new BufferedInputStream( new FileInputStream("/Users/taysayshaguy/Desktop/utilities/chapter_4/reports/DbReport.jasper")); later I then made a directory and thus a path InputStream reportStream = getServletConfig().getServletContext() .getResourceAsStream("WEB-INF/Xreports/DbReport.jasper"); so the complier is just SMILING! So you have a wonderful day.
  2. Hi xenophex, you can increase the memory required by your application by increasing the memory alotted to the JVM , from your IDE in netbeans you right click your project and go to the properties link from where you will click on the run node and set the parameter via a text field to your right, as regards the exception pls can you paste your code at least the related part in your post so we can trace it together , but before then import the libraries from your jasper destro/dist directory and then the destro/lib now the files in here are so many that , you have to know which jar to add by the error the application throws, now you have to be patient here, Good Luck, Pls did your mac os x come with java 6 or you upgraded you currentJDK , pls can you give me a lead I want to change my jdk from 1.5 to 1.6 , thanx
  3. Hi all, Pls anyone with the solution to the problem above I seem to get a similar error I wonder why when I run this servlet in a bid to execute a jasper report Code:/* * To change this template, choose Tools | Templates * and open the template in the editor. */package net.ensode.jasperbook;import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;import java.io.StringWriter;import java.sql.Connection;import java.sql.DriverManager;import java.util.HashMap;import javax.servlet.ServletException;import javax.servlet.ServletOutputStream;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import net.sf.jasperreports.engine.JasperRunManager;public class DbReportServlet extends HttpServlet{ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection connection; ServletOutputStream servletOutputStream = response.getOutputStream(); InputStream reportStream = getServletConfig().getServletContext() .getResourceAsStream("/reports/DbReport.jasper"); //.getResourceAsStream("http://localhost:5050/reports/DbReport.jasper"); System.out.println("reportStream :::>"+reportStream); *************MY PRINT OUT WHICH RETURNS NULL try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager .getConnection("jdbc:mysql://localhost:3306/flightstats?user=taysay&password=taysay"); JasperRunManager.runReportToPdfStream(reportStream, servletOutputStream, new HashMap(), connection); connection.close(); response.setContentType("application/pdf"); servletOutputStream.flush(); servletOutputStream.close(); } catch (Exception e) { // display stack trace in the browser StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); response.setContentType("text/plain"); response.getOutputStream().print(stringWriter.toString()); } }}i get java.lang.NullPointerException at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2213) at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2226) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2694) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:761) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277) at net.sf.jasperreports.engine.util.ContextClassLoaderObjectInputStream.<init>(ContextClassLoaderObjectInputStream.java:57) at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:197) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:380) at net.sf.jasperreports.engine.JasperRunManager.runReportToPdfStream(JasperRunManager.java:163) at net.ensode.jasperbook.DbReportServlet.doGet(DbReportServlet.java:46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:613)I tried trouble shooting and I discovered the InputStream InputStream reportStream = getServletConfig().getServletContext().getResourceAsStream("/reports/DbReport.jasper"); System.out.println("reportStream :::>"+reportStream); *************MY PRINT OUT WHICH RETURNS NULLreturns null leading to a null pointer at this point
×
×
  • Create New...