I m newbie in jasper report. I m trying to call jasper report in cold fusion 7.
i have included all the jar files required for jasper report in the cfusionMX7/wwwroot/Web-INF folder. the list of jar files are -
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\bsh-1.3.0;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-beanutils-1.7.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-collections-2.1.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-digester-1.7.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-logging-api-1.0.4.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-logging-1.0.4.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\iReport-utils-2.0.1.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\itext-1.3.1.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\jasperreports-2.0.2.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\jcmdline-1.0.2.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\jcommon-1.0.0.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\poi-2.5.1-final-20040804.jar;
C:\CFUSIONMX7\wwwroot\WEB-INF\lib\sqljdbc.jar;
I m using the SQL Server 2005. i have using Windows ODBC DSN for connecting to SQL Server 2005 and connection is successful.
Here is the cold fusion code -
<cfscript>
system = CreateObject("java", "java.lang.System");
classpath = system.getProperty("java.class.path");
if (FindNoCase("jasperreportss", classpath) LTE 0)
{
classpath = classpath & ";C:\CFUSIONMX7\wwwroot\WEB-INF\lib\bsh-1.3.0;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-beanutils-1.7.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-collections-2.1.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-digester-1.7.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-logging-api-1.0.4.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\commons-logging-1.0.4.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\iReport-utils-2.0.1.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\itext-1.3.1.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\jasperreports-2.0.2.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\jcmdline-1.0.2.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\jcommon-1.0.0.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\poi-2.5.1-final-20040804.jar;C:\CFUSIONMX7\wwwroot\WEB-INF\lib\sqljdbc.jar;";
system.setProperty("java.class.path", classpath);
}
clazz = CreateObject("java", "java.lang.Class");
clazz.forName("sun.jdbc.odbc.JdbcOdbcDriver");
driverManager = CreateObject("java", "java.sql.DriverManager");
conurl = "jdbc:odbc:test;user=sa;password="userpassword"";
connection = driverManager.getConnection(conurl);
jasperCompileManager = CreateObject("java", "net.sf.jasperreports.engine.JasperCompileManager");
parameters = CreateObject("java", "java.util.HashMap");
parameters.put("ReportTitle", "Basic JasperReport");
jasFillManager=CreateObject("java","net.sf.jasperreports.engine.JasperFillManager");
jasperPrint = jasFillManager.fillReportToFile(jasReport,parameters, connection);
JasperExportManager=CreateObject("java","net.sf.jasperreports.engine.JasperExportManager");
JasperExportManager.exportReportToPdfFile(jasperPrint, "C:\Inetpub\wwwroot\jasperreports\test.pdf");
connection.close();
</cfscript>
When i run this code i m getting following error in compling the jrxml file -
inconvertible types found : int required: java.lang.Integer value = (java.lang.Integer)(1)
so i used the test.jasper file which is complied by ireport itself using Jasper Studio and changed the following lines in code -
jasperFile="/jasperReport/test.jasper";
jasLoader=CreateObject("java","net.sf.jasperreports.engine.util.JRLoader");
clsLoader = CreateObject("java", "java.lang.ClassLoader");
jasReport = jasLoader.loadObjectFromLocation(jasperFile,clsLoader);
jasFillManager=CreateObject("java","net.sf.jasperreports.engine.JasperFillManager");
parameters = CreateObject("java", "java.util.HashMap");
parameters.put("ReportTitle", "Basic JasperReport");
jasperPrint = jasFillManager.fillReportToFile(jasReport,parameters, connection);
but using this code i get the following error -
The report template C:\Inetpub\wwwroot\jasperReport\test.jasper appears to be malformed or contain errors.
Can anyone help me here where i m wrong. or any one can provide me the code or some links where i can get the solution. i m trying since last 2 days in many sites but still didn't get any solution.
Any help would be appreciated
Thanks
Renuka
This post has been edited by rgupta: 10 February 2009 - 07:47 AM