Jump to content
JasperReports Library 7.0 is now available ×

UNABLE TO VIEW REPORT IN MY JAVA APP (URGENT)


2006 IR Open Dicussion

Recommended Posts

By: asumoto - asumoto

UNABLE TO VIEW REPORT IN MY JAVA APP (URGENT)

2006-07-12 00:32

Currently i am using J2SDK1.4.2_07 for my java compiler and J2RE1.4.2_07 for my java runtime and MySql 3.23.55. I am also using IReport 0.1.0 version and everything work fine. I can successfully generate report from my java application by put the *.jasper file generate by IReport into my java program directory and i can call and view the report successfully. The jasper file is generated by IReport 0.1.0 To link the my java program with the report i need to copy few *.jar files from ireport library folder into my java runtime library folder. What i can say is everything works fine and i can successfully filter and generate my report from my java application.

 

Problem occured when i upgrade IReport from 0.1.0 into 1.2.2. The IReport 1.2.2 generate jasper file also and i did the same thing by copy the jasper file into my java application. But when i run my java application to view the report I can not view the report at all and my java program generate an exception.

The exception message below :

 

java.lang.ClassCastException

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:288)

at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:810)

at pos.PosReport.ReportFilter.goView(ReportFilter.java:581)

 

i dont understand because this is happen only when my java program call the jasper file generated by IReport 1.2.2 but there is no problem when my java program call the jasper file generated by IReport 0.1.0 and i can see the report perfectly. I already copy the whole jar file under library folder from IReport 1.2.2 into my J2RE1.4.2_07 library folder, the same way i did to IReport 0.1.0

 

Is there something i need to change under my java coding?

 

Can anybody pls write a sample java coding for me to call the report from java program?

 

What are the classes that i need to import into my coding?

 

Below is my currently java coding to filter and view the report. Its work with IReport 0.1.0

 

import dori.jasper.engine.*;

import dori.jasper.view.*;

import dori.jasper.engine.export.*;

 

public class ReportFilter implements ActionListener

{

public ReportFilter

{

// all the source code for gui come to here

JButton runButton = new JButton ("Run Report");

runButton.addActionListener(this);

}

 

public actionPerformed(ActionEvent e)

{

if(e.getSource().equals(runButton))

{

goView();

}

}

 

//below is the code when user press run report button and it will call the jasper file and generate report to view

 

private void goView()

{

// few GUI coding generate from here for generate the dialog box

 

// below is the code to use jasper engine to call report

// The error message above is generate from this code

 

try

{

//System.out.println("1 - "+new java.util.Date());

JasperPrint jasperPrint = JasperManager.fillReport(file, parameters, getDataSource());

//System.out.println("4 - "+new java.util.Date());

//jasperPrint = JasperManager.fillReport(file, parameters, conn);

JRViewer jrv = new JRViewer(jasperPrint);

//System.out.println("5 - "+new java.util.Date());

dialog.getContentPane().add(jrv,BorderLayout.CENTER);

 

}

catch (Exception ex)

{

ex.printStackTrace();

}

 

}}

 

can anyone tell me what is wrong with the code above? The code above is work fine with jasper file generated by IReport 0.1.0 but it is failed when work with jasper file generated by IReport 1.2.2

Please help me it is very urgent.

 

Does i need to copy jar file from ireport library into my java runtime library? If need which jar file i need to copy?

 

 

 

 

 

 

 

 

By: Giulio Toffoli - gt78

RE: UNABLE TO VIEW REPORT IN MY JAVA APP (URGENT)

2006-07-13 01:05

Be sure you are using in your app the same JasperReports.jar version used with iReport:

 

iReport 1.2.2 uses jasperreports-1.2.2.jar

iReport 1.1.0 uses jasperreports-1.1.0.jar

 

Giulio

 

 

 

 

By: asumoto - asumoto

RE: UNABLE TO VIEW REPORT IN MY JAVA APP (URGENT)

2006-07-13 19:24

hi Giulio currently my java program run for ireport ver 0.1.0 so i just copy all the *.jar files under ireport 0.1.0 lib folder into my J2RE1.4.2_07libext because my java application report all using ireport ver 0.1.0 and i got few report done use ireport 1.2.2 so i also copy all the *.jar files under ireport 1.2.2 into my J2RE1.4.2_07libext so there are a mixing *.jar files from ireport ver 0.1.0 library and ireport ver 1.2.2 library. Is it possible for me to do that because i have mixing jasper files version done by ireport 0.1.0 and ireport 1.2.2?

Do i need to recompile all the jasper report i done under 0.1.0 with the ireport 1.2.2?

I mix this *.jar files library from ireport 0.1.0 and ireport 1.2.2 because i still need report from my ireport 0.1.0 and after I MIXED all the *.jar files from both version, I still can view the jasper report done by version 0.1.0 perfectly but the jasper report done by version 1.2.2 can not be seen and it gave me error message like above. Please help me .........

 

Below is the *.jar files taken from ireport 0.1.0 library and ireport 1.2.2 library into my J2RE1.4.2_07libext :

 

From ireport 0.1.0 library:

ant.jar

commons-beanutils.jar

commons-collections.jar

commons-digester.jar

commons-logging.jar

commons-logging-api.jar

hsqldb.jar

itext-0.96.jar

jakarta-poi-1.5.1-final-20020615.jar

jasperreports-0.4.6.jar

xercesImpl.jar

xmlParserAPIs.jar

 

From IReport ver 1.2.2 lib:

xml-apis.jar

xercesImpl.jar --> currently this one i am using replace the ver 0.1.0

xalan.jar

tools.jar --> this tools.jar taken from J2SDK1.4.2_07lib

toniclf.jar

tinylaf.jar

poi-2.0-final-20040126.jar

png-encoder-1.5.jar

nsisant-1.1.jar

mysql_comp.jar --> this mysql.jar file is taken from my previous mysql engine and i am not using mysql connector u provided under ireport 1.2.2 because it is doesn't work with my current database but i dont think its a problem since i am generate report from ireport 1.2.2 also using this jar file and the report works fine after i compile and view it under ireport 1.2.2 version.

looks-2.0-rc.jar

log4j-1.2.8.jar

jxl.jar

jta.jar

jsmoothgen-ant-0.9.7.jar

jr-bsh-compiler.jar

jfreechart-1.0.0.jar

jdt-compiler.jar

jcommon-1.0.0.jar

jcmdline-1.0.2.jar

jasperreports-1.2.2.jar --> i have 2 jasperreports under my java runtime library folder. The first jasperreport is ver 0.4.6 as u can see above and the second is this jasperreport. I mixed it because i still need to view my old jasper report version done by ireport 0.1.0 and if i remove the old jasperreport version 0.4.6 i can not view my jasper report from my java application.

itext-1.3.1.jar

ireport.jar

hsqldb-1.7.1.jar

hibernate3.jar

groovy-all-1.0-beta-10.jar

ehcache-1.1.jar

dom4j-1.6.jar

commons-logging-api-1.0.2.jar

commons-logging-1.0.2.jar

commons-javaflow-20060411.jar

commons-digester-1.7.jar

commons-collections-2.1.jar

commons-beanutils-1.5.jar

cglib-2.1.jar

bsh-1.3.0.jar

barbecue-1.1.jar

asm-attrs.jar

asm.jar

antlr-2.7.5H3.jar

 

Thats all the jar files i put under J2RE1.4.2_07libext folder and i can view the old jasper report but can not view the new jasper report.

 

If i delete the jaspperreport0.4.6.jar file and i put only the jasperreport1.2.2.jar file into my java runtime library folder it will generate error message for me and BOTH of the old jasper report ver 0.1.0 and jasper report ver 1.2.2 can not be seen......

The error message generated is:

java.lang.NoClassDefFoundError : dori/jasper/engine/JRDataSource

 

 

BUT IF I PUT BOTH THE JASPERREPORTS0.4.6.JAR AND JASPERREPORTS-1.2.2.JAR TOGETHER I CAN VIEW THE OLD JASPER REPORT GENERATE FROM IREPORT 0.1.0 PERFECTLY BUT I STILL CAN NOT SEE THE NEW JASPER REPORT GENERATE BY IREPORT 1.2.2

The error message given to me in this situation when i try to view the jasper report generated by ireport 1.2.2 is:

java.lang.ClassCastException

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:288)

at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:810)

 

Please help me.... is it possible to mix 2 jasperreports.jar into one java runtime library folder?

what is the solution if i want to use both jasper report generated by ireport 0.1.0 and ireport 1.2.2 together in my java application?

 

 

 

 

 

By: ts_chung - ts_chung

RE: UNABLE TO VIEW REPORT IN MY JAVA APP (URGENT)

2006-07-14 18:40

i think it is not possible to use 2 jasperreports.jar library.

however, i suggest that you recompile all your jasper report using ireport 1.2.2 and use only the jasperreport.jar library that in ireport 1.2.2.

i hope this fix ur problem

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...