Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25
  1. #21
    sukualka is offline Member
    Join Date
    Sep 2011
    Posts
    1
    Rep Power
    0

    Default Re: Jasperreports problem

    Hello Frnds!!

    Need a help , I am trying to call jasper report from jsp .
    I am generating .jrxml file from ireport4.0.2.. I am using eclipse ide and tomcat server to run the program.

    My jsp code is here :

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="java.util.HashMap"%>
    <%@ page import="net.sf.jasperreports.engine.JRException"%>
    <%@ page import="net.sf.jasperreports.engine.JasperCompileM anager"%>
    <%@ page import="net.sf.jasperreports.engine.JasperExportMa nager" %>
    <%@ page import="net.sf.jasperreports.engine.JasperFillMana ger" %>
    <%@ page import="net.sf.jasperreports.engine.JasperPrint" %>
    <%@ page import="net.sf.jasperreports.engine.JasperReport" %>
    <%@ page import="net.sf.jasperreports.engine.data.JRXmlData Source"%>
    <%@ page import="net.sf.jasperreports.engine.data.*"%>
    <%@ page import="net.sf.jasperreports.engine.JRParameter" %>
    <%@ page import="java.sql.Connection"%>
    <%@ page import="java.sql.DriverManager"%>





    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <%
    try{
    %>
    <%
    JasperReport jasperReport;
    JasperPrint jasperPrint;
    HashMap jasperParameter = new HashMap();
    Connection con = null;
    Statement statement = null;
    Class.forName("oracle.jdbc.OracleDriver").newInsta nce();
    con = DriverManager.getConnection("jdbc:oracle:thin:@loc alhost:1521/rdnt","appuser","appuser");

    if(con!=null)
    out.println("connect to database.");
    jasperReport = JasperCompileManager.compileReport ("C:/Alaka/jASPERrEPORTS/reporttest.jrxml");
    jasperPrint = JasperFillManager.fillReport(jasperReport,jasperPa rameter, con);
    JasperExportManager.exportReportToPdfFile(jasperPr int, "C://sample_report.pdf");

    }

    catch (Exception ex)
    {%></font><font size="+3" color="red"></b>
    <%out.println("Unable to connect to database.");
    out.println(ex);}%>



    </body>
    </html>


    I am getting following error :

    HTTP Status 500 -

    --------------------------------------------------------------------------------

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Servlet execution threw an exception


    root cause

    java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
    net.sf.jasperreports.engine.JasperCompileManager.c ompileReport(JasperCompileManager.java:146)
    test.HelloTest.doGet(HelloTest.java:50)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:717)


    root cause

    java.lang.ClassNotFoundException: org.apache.commons.digester.Digester
    java.net.URLClassLoader$1.run(Unknown Source)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    net.sf.jasperreports.engine.JasperCompileManager.c ompileReport(JasperCompileManager.java:146)
    test.HelloTest.doGet(HelloTest.java:50)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:717)


    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33 logs.


    --------------------------------------------------------------------------------

    Apache Tomcat/6.0.33




    Please help me to resolve it.

    Regards
    Alaka

  2. #22
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default Re: Jasperreports problem

    Start new thread if you want to ask.

    And

    Use code tags when posting codes.

  3. #23
    Levian is offline Senior Member
    Join Date
    Jun 2011
    Posts
    109
    Rep Power
    0

    Default Re: Jasperreports problem

    Revisited when I thought this is a closed case.

    Due some suggestion I changed my design template...modifying the current jrxml file.
    Then I failed on generating a runnable jar which quite confusing and upon tracing the problem, I see that the changes I made are somehow not applied.
    If I see the preview of the jrxml and fill in the parameter, I'll see the new modified report, however when I run the java file and hit the report button, I'll see the old unmodified report.

    Java Code:
    		JasperCompileManager.compileReport("D:/Documents and Settings/Administrator/workspace/TnD2/src/TnD2/actreport.jrxml");
    problem should lies in this line, assuming from what I read JasperCompileManager is supposedly compile the .jrxml into a .jasper file...I temporarily removed the .jasper file and re-run the program...but it gives me error on finding the .jasper file.
    This currently put me stuck again...and I'm re-tracing back on what I did when I successfully made that .jasper file.

    -----
    sukualka, I didn't make a jsp, just non-web java application under eclipse...also I didn't use iReport, using JasperWave instead, and as said better to put a new thread for your question.

    However this :
    java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
    is somewhat similar to what I faced sometime ago, you'll need to get the jasperreports api and then put it into the build path, library, classpath or whatever it calls that you need in your program and specifically pointing out where the beanutils, and some more commons jar files that's needed.
    I can't really guarantee that will solve the problem as I'm myself new to this.


    Thanks and regards,
    First is to make something usable, next is to aim for perfection which means a never ending improvements.

  4. #24
    Levian is offline Senior Member
    Join Date
    Jun 2011
    Posts
    109
    Rep Power
    0

    Default Re: Jasperreports problem

    OK, reason to revisit this which is grabbing the old code works as I want...jasper file generated and runnable jar can be created. Now I just need to think on this.

    Again thanks and regards,
    First is to make something usable, next is to aim for perfection which means a never ending improvements.

  5. #25
    Levian is offline Senior Member
    Join Date
    Jun 2011
    Posts
    109
    Rep Power
    0

    Default Re: Jasperreports problem

    Problem was fixed and I can generate report along with the jasper file, however there seems problem when I create runnable jar and put it in another PC. I posted it in jasperreports forum, yet unresolved so far, so I re-post here.

    Re-posted from JasperForge > JasperReports Library Forums

    If there's anyone who knows what the problem here, please share a light in this, I've been reading, googling, etc...but seems really clueless.


    Thanks in advance,
    First is to make something usable, next is to aim for perfection which means a never ending improvements.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. jasperreports API
    By Levian in forum New To Java
    Replies: 0
    Last Post: 09-09-2011, 08:54 AM
  2. JasperReports, pdf and others.
    By hendrix79 in forum New To Java
    Replies: 0
    Last Post: 01-28-2009, 11:33 PM
  3. JasperReports 2.0.5
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 03-14-2008, 07:29 PM
  4. Reports in JasperReports
    By Jack in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 04:09 AM
  5. JasperReports 1.3.4
    By levent in forum Java Software
    Replies: 0
    Last Post: 06-19-2007, 06:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •