Problem when give the Jasper Reports complied file name

Hi master sir I flow your guidance but when I give complied file name that give me error on that line

See my code

Connection conn = null ;

try {

javax.naming.Context ctx = new javax.naming.InitialContext() ;

DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/Travel" ) ;

conn = ds.getConnection() ;

} catch (Exception ex) {

error(" Error counting rows: " + ex.getMessage() );

}

JasperReport jasperReport;

JasperPrint jasperPrint;

jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");

sir what wrong with this code

jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");

sir this line give me error

sir please give idea how I create pdf give all remaining step after this error line

thank抯

aamir

[873 byte] By [mfa786a] at [2007-11-27 7:32:23]
# 1

That is more a question for a JasperReports forum. Also, you have to say what error you are getting. There are many different causes and the error message can help determine what is your specific cause. For example, I believe that the compileReport takes a .jrxml file and compiles it into a .jasper file, yet you are providing it the .jasper file. Perhaps the server does not have write permissions on the directory into which you are putting the compiled file. You should put the code in a try catch block and call log() with the error message, then look in the Server log to see what the error is.

A different approach is presented in http://developers.sun.com/jscreator/learning/tutorials/2/reports.html. In this approach, the reports are compiled when you build the project, not everytime someone runs the report.

This tutorial also shows how to create and display the PDF.

jetsonsa at 2007-7-12 19:12:38 > top of Java-index,Development Tools,Java Tools...
# 2

thank's for your reply

sir i try your give guide line

i use log(" Error Description" , ex); this code

and check in server log file

then i found this error

Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication15/build/web/WEB-INF/lib/log4j-core.ja r

all error this

Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication15/build/web/WEB-INF/lib/log4j-core.ja r

at java.net.URI$Parser.fail(URI.java:2809)

at java.net.URI$Parser.checkChars(URI.java:2982)

at java.net.URI$Parser.parseHierarchical(URI.java:3066)

at java.net.URI$Parser.parse(URI.java:3014)

at java.net.URI.<init>(URI.java:578)

at com.sun.enterprise.loader.EJBClassLoader$URLEntry.init(EJBClassLoader.java:848)

... 16 more

|#]

[#|2007-06-15T12:55:53.587+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=17;|DPL5109: EJBC - START of EJBC for [WebApplication15]|#]

[#|2007-06-15T12:55:53.587+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=17;|Processing beans ...|#]

[#|2007-06-15T12:55:53.587+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=17;|DPL5110: EJBC - END of EJBC for [WebApplication15]|#]

[#|2007-06-15T12:55:53.697+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=17;|Total Deployment Time: 438 msec, Total EJB Compiler Module Time: 0 msec, Portion spent EJB Compiling: 0%

Breakdown of EJBC Module Time: Total Time for EJBC: 0 msec, CMP Generation: 0 msec (0%), Java Compilation: 0 msec (0%), RMI Compilation: 0 msec (0%), JAX-RPC Generation: 0 msec (0%),

please give me idea how i get result

thank's

mfa786a at 2007-7-12 19:12:38 > top of Java-index,Development Tools,Java Tools...
# 3

I do not believe that the error message you show is related to yoru problem. I am not sure out of context, but I think that error you gave me was emitted at deployment time. We are looking for a runtime error that happens when you try to compile the jasper report (why you are compiling a compiled report is still confusing to me - shouldn't you be passing the .jrxml file?)

I suggest that you put in log statements throughout the code that is giving you problems so that you can make sure you are reading the right error message. Something like:

Connection conn = null ;

log("*********** connecting");

try {

javax.naming.Context ctx = new javax.naming.InitialContext() ;

DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/Travel" ) ;

conn = ds.getConnection() ;

} catch (Exception ex) {

error(" Error counting rows: " + ex.getMessage() );

log(" Error counting rows: " + ex.getMessage() );

}

JasperReport jasperReport;

JasperPrint jasperPrint;

log("compiling report");

try {

jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");

} catch (Exception ex) {

log(" ********* Error compiling report: " + ex.getMessage() );

}

Then right-click the server node and choose View Log, so that the application server log appears in the bottom of the IDE. When you run the program, watch this log. You want to look for the errors that you logged in your code.

Then, when you get the right error messages use Google to search on the important part of the string (for example, with the error message that you just showed me, you would search for "Illegal character in path at index". You will usually find the fix that way.

As for the error message that you gave me, if you read the error message you will see it says:

Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication15/build/web/WEB-INF/lib/log4j-core.ja r

If you look at the path shown in the error message (below) you will see a space in the 18th position:

I am not able to help you with that error, it is out of my area of expertise.

jetsonsa at 2007-7-12 19:12:38 > top of Java-index,Development Tools,Java Tools...
# 4

thank you for detail reply

Sir I use oracle with sun java studio creater and designed the report in ireport and test that give right result in ireport preview

Sir I flow your given code

These file I import

import com.sun.rave.web.ui.appbase.AbstractPageBean;

import com.sun.rave.web.ui.component.Body;

import com.sun.rave.web.ui.component.Form;

import com.sun.rave.web.ui.component.Head;

import com.sun.rave.web.ui.component.Html;

import com.sun.rave.web.ui.component.Link;

import com.sun.rave.web.ui.component.Page;

import javax.faces.FacesException;

import com.sun.rave.web.ui.component.Button;

import java.sql.*;

import javax.sql.DataSource;

import net.sf.jasperreports.engine.*;

import net.sf.jasperreports.engine.design.*;

import net.sf.jasperreports.engine.JRException;

import net.sf.jasperreports.engine.xml.JRXmlLoader;

import net.sf.jasperreports.engine.JasperCompileManager;

import net.sf.jasperreports.engine.JasperFillManager;

import net.sf.jasperreports.engine.JasperExportManager;

import net.sf.jasperreports.engine.JasperPrint;

import net.sf.jasperreports.engine.JasperReport;

import net.sf.jasperreports.engine.design.JasperDesign;

import net.sf.jasperreports.view.JasperViewer;

import net.sf.jasperreports.engine.JasperPrintManager;

this your code code I use

public String button1_action() {

Connection conn = null ;

log("*********** connecting");

try {

javax.naming.Context ctx = new javax.naming.InitialContext() ;

DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/datasource1" ) ;

conn = ds.getConnection() ;

} catch (Exception ex) {

error(" Error counting rows: " + ex.getMessage() );

log(" Error counting rows: " + ex.getMessage() );

}

JasperReport jasperReport;

JasperPrint jasperPrint;

log("compiling report");

try {

//jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");

jasperReport = JasperCompileManager.compileReport("./report/mfa.jasper");

} catch (Exception ex) {

log(" ********* Error compiling report: " + ex.getMessage() );

}

return null;

}

}

but sir when I run project and press button the page not give me resutlt

then I check in server view log file that give me this detail

Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication17/build/web/WEB-INF/lib/log4j-core.ja r

at java.net.URI$Parser.fail(URI.java:2809)

at java.net.URI$Parser.checkChars(URI.java:2982)

at java.net.URI$Parser.parseHierarchical(URI.java:3066)

at java.net.URI$Parser.parse(URI.java:3014)

at java.net.URI.<init>(URI.java:578)

at com.sun.enterprise.loader.EJBClassLoader$URLEntry.init(EJBClassLoader.java:848)

... 16 more

|#]

[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=19;|DPL5109: EJBC - START of EJBC for [WebApplication17]|#]

[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=19;|Processing beans ...|#]

[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=19;|DPL5110: EJBC - END of EJBC for [WebApplication17]|#]

[#|2007-06-16T12:44:13.256+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=19;|Total Deployment Time: 547 msec, Total EJB Compiler Module Time: 15 msec, Portion spent EJB Compiling: 2%

Breakdown of EJBC Module Time: Total Time for EJBC: 15 msec, CMP Generation: 0 msec (0%), Java Compilation: 0 msec (0%), RMI Compilation: 0 msec (0%), JAX-RPC Generation: 0 msec (0%),

|#]

[#|2007-06-16T12:44:13.334+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.deployment|_ThreadID=19;|deployed with moduleid = WebApplication17|#]

[#|2007-06-16T12:44:13.522+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=15;|ADM1041:Sent the event to instance:[ApplicationDeployEvent -- reference-added WebApplication17]|#]

[#|2007-06-16T12:44:13.553+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=15;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]

[#|2007-06-16T12:44:13.584+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=14;|ADM1041:Sent the event to instance:[ModuleDeployEvent -- deploy web/WebApplication17]|#]

[#|2007-06-16T12:44:13.615+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=14;|WEB0100: Loading web module [WebApplication17] in virtual server [server] at [/WebApplication17]|#]

[#|2007-06-16T12:44:14.787+0500|WARNING|sun-appserver-pe8.2|org.apache.commons. beanutils.MethodUtils|_ThreadID=14;|Cannot use JVM pre-1.4 access bug workaround die to restrictive security manager.|#]

[#|2007-06-16T12:44:15.022+0500|WARNING|sun-appserver-pe8.2|org.apache.commons. digester.Digester|_ThreadID=14;|[ComponentRule]{faces-config/component} Merge(com.sun.rave.web.ui.Time)|#]

[#|2007-06-16T12:44:15.178+0500|WARNING|sun-appserver-pe8.2|org.apache.commons. digester.Digester|_ThreadID=14;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigDecimal)|#]

[#|2007-06-16T12:44:15.178+0500|WARNING|sun-appserver-pe8.2|org.apache.commons. digester.Digester|_ThreadID=14;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigInteger)|#]

[#|2007-06-16T12:44:16.131+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=14;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]

[#|2007-06-16T12:46:41.720+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=20;|WebModule[/WebApplication17]*********** connecting|#]

[#|2007-06-16T12:46:41.751+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=20;|WebModule[/WebApplication17] Error counting rows: null|#]

[#|2007-06-16T12:46:41.751+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=20;|WebModule[/WebApplication17]compiling report|#]

[#|2007-06-16T12:46:41.767+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=20;|WebModule[/WebApplication17] ********* Error compiling report: java.io.FileNotFoundException: .\report\mfa.jasper (The system cannot find the path specified)|#]

[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=21;|WebModule[/WebApplication17]*********** connecting|#]

[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=21;|WebModule[/WebApplication17] Error counting rows: null|#]

[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=21;|WebModule[/WebApplication17]compiling report|#]

[#|2007-06-16T12:51:56.984+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=21;|WebModule[/WebApplication17] ********* Error compiling report: java.io.FileNotFoundException: .\rep

Main error is

Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication17/build/web/WEB-INF/lib/log4j-core.ja r

Please give me idea how I get call pdf report

Thank抯

aamir

mfa786a at 2007-7-12 19:12:38 > top of Java-index,Development Tools,Java Tools...
# 5

Sir I flow your instruction and see in server view log file that in last line give this error

[#|2007-06-16T15:22:44.761+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=21;|WebModule[/WebApplication17] ********* Error compiling report: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.|#]

what mean抯 theInvalid byte 1 of 1-byte UTF-8 sequence

please give idea how I solve this error

thank抯

aamir

mfa786a at 2007-7-12 19:12:38 > top of Java-index,Development Tools,Java Tools...
# 6

I think you need to ask the JasperReports people why their compiler is throwing this exception. This problem is not related to the Sun Java Studio Creator IDE.

I searched google for "MalformedByteSequenceException" and found the following. Maybe one of them will give you an idea of the source of your problem

http://www.biglist.com/lists/xsl-list/archives/200702/msg00041.html

http://www.biglist.com/lists/xsl-list/archives/200702/msg00044.html

http://www.biglist.com/lists/xsl-list/archives/200702/msg00048.html

http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/3 7b476469a6210ae/a878fee808a62066

jetsonsa at 2007-7-12 19:12:38 > top of Java-index,Development Tools,Java Tools...