Cold Fusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingCold Fusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 11th, 2009, 05:09 AM
rg3 rg3 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2009
Posts: 1 rg3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 40 sec
Reputation Power: 0
Question Calling jasper report in Cold fusion

Hi,

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:CFUSIONMX7wwwrootWEB-INFlibbsh-1.3.0;
C:CFUSIONMX7wwwrootWEB-INFlibcommons-beanutils-1.7.jar;
C:CFUSIONMX7wwwrootWEB-INFlibcommons-collections-2.1.jar;
C:CFUSIONMX7wwwrootWEB-INFlibcommons-digester-1.7.jar;
C:CFUSIONMX7wwwrootWEB-INFlibcommons-logging-api-1.0.4.jar;
C:CFUSIONMX7wwwrootWEB-INFlibcommons-logging-1.0.4.jar;
C:CFUSIONMX7wwwrootWEB-INFlibiReport-utils-2.0.1.jar;
C:CFUSIONMX7wwwrootWEB-INFlibitext-1.3.1.jar;
C:CFUSIONMX7wwwrootWEB-INFlibjasperreports-2.0.2.jar;
C:CFUSIONMX7wwwrootWEB-INFlibjcmdline-1.0.2.jar;
C:CFUSIONMX7wwwrootWEB-INFlibjcommon-1.0.0.jar;
C:CFUSIONMX7wwwrootWEB-INFlibpoi-2.5.1-final-20040804.jar;
C:CFUSIONMX7wwwrootWEB-INFlibsqljdbc.jar;

I m using the SQL Server 2005. i m 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:CFUSIONMX7wwwrootWEB-INFlibbsh-1.3.0;C:CFUSIONMX7wwwrootWEB-INFlibcommons-beanutils-1.7.jar;C:CFUSIONMX7wwwrootWEB-INFlibcommons-collections-2.1.jar;C:CFUSIONMX7wwwrootWEB-INFlibcommons-digester-1.7.jar;C:CFUSIONMX7wwwrootWEB-INFlibcommons-logging-api-1.0.4.jar;C:CFUSIONMX7wwwrootWEB-INFlibcommons-logging-1.0.4.jar;C:CFUSIONMX7wwwrootWEB-INFlibiReport-utils-2.0.1.jar;C:CFUSIONMX7wwwrootWEB-INFlibitext-1.3.1.jar;C:CFUSIONMX7wwwrootWEB-INFlibjasperreports-2.0.2.jar;C:CFUSIONMX7wwwrootWEB-INFlibjcmdline-1.0.2.jar;C:CFUSIONMX7wwwrootWEB-INFlibjcommon-1.0.0.jar;C:CFUSIONMX7wwwrootWEB-INFlibpoi-2.5.1-final-20040804.jar;C:CFUSIONMX7wwwrootWEB-INFlibsqljdbc.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 = "jdbcdbc: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.jasperr eports.engine.JasperFillManager");

jasperPrint = jasFillManager.fillReportToFile(jasReport,paramete rs, connection);
JasperExportManager=CreateObject("java","net.sf.ja sperreports.engine.JasperExportManager");

JasperExportManager.exportReportToPdfFile(jasperPr int, "C:Inetpubwwwrootjasperreportstest.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 -

<cfscript>
system = CreateObject("java", "java.lang.System");
classpath = system.getProperty("java.class.path");
if (FindNoCase("jasperreportss", classpath) LTE 0)
{
classpath = classpath & ";C:CFUSIONMX7wwwrootWEB-INFlibbsh-1.3.0;C:CFUSIONMX7wwwrootWEB-INFlibcommons-beanutils-1.7.jar;C:CFUSIONMX7wwwrootWEB-INFlibcommons-collections-2.1.jar;C:CFUSIONMX7wwwrootWEB-INFlibcommons-digester-1.7.jar;C:CFUSIONMX7wwwrootWEB-INFlibcommons-logging-api-1.0.4.jar;C:CFUSIONMX7wwwrootWEB-INFlibcommons-logging-1.0.4.jar;C:CFUSIONMX7wwwrootWEB-INFlibiReport-utils-2.0.1.jar;C:CFUSIONMX7wwwrootWEB-INFlibitext-1.3.1.jar;C:CFUSIONMX7wwwrootWEB-INFlibjasperreports-2.0.2.jar;C:CFUSIONMX7wwwrootWEB-INFlibjcmdline-1.0.2.jar;C:CFUSIONMX7wwwrootWEB-INFlibjcommon-1.0.0.jar;C:CFUSIONMX7wwwrootWEB-INFlibpoi-2.5.1-final-20040804.jar;C:CFUSIONMX7wwwrootWEB-INFlibsqljdbc.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 = "jdbcdbc:test;user=sa;password=userpassword" ;
connection = driverManager.getConnection(conurl);

jasperFile="/jasperReport/test.jasper";
jasLoader=CreateObject("java","net.sf.jasperreport s.engine.util.JRLoader");
clsLoader = CreateObject("java", "java.lang.ClassLoader");
jasReport = jasLoader.loadObjectFromLocation(jasperFile,clsLoa der);

jasFillManager=CreateObject("java","net.sf.jasperr eports.engine.JasperFillManager");

parameters = CreateObject("java", "java.util.HashMap");
parameters.put("ReportTitle", "Basic JasperReport");

jasperPrint = jasFillManager.fillReportToFile(jasReport,paramete rs, connection);
JasperExportManager=CreateObject("java","net.sf.ja sperreports.engine.JasperExportManager");

JasperExportManager.exportReportToPdfFile(jasperPr int, "C:Inetpubwwwrootjasperreportstest.pdf");
connection.close();

</cfscript>
<H3>Success!</H3>

but using this .jasper file i m still getting error which is -

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
Rg

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingCold Fusion Development > Calling jasper report in Cold fusion


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap