Jump to content

Jasper Compiling error in eclipse


chiragonline

Recommended Posts

If I run following method from main it works well, but when I try to run from eclipse application it gives following error !!

why ?

it has something to do with

http://jira.codehaus.org/browse/MOJO-1141

 

???

 

I am using eclipse 3.3, java 1.5, Jasper 2.5 and xp.

 

Please help.

 

void createReport()

{

try

{

DataSourceProvider dataSourceProvider = new DataSourceProvider();// DataSourceProvider contais one object of type "SeatInfo" class

JasperReport jasperReport = null;

InputStream inpstr = new FileInputStream("one.jrxml" );

System.out.println( "Compiling report..." );

jasperReport = JasperCompileManager.compileReport( inpstr );//here it is giving error

:

:

}

catch ( Exception e )

{

e.printStackTrace();

}

 

}

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

Compiling report...

net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :

1. java.lang.ClassNotFoundException: com.sabre.dataobjects.SeatInfo

at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:260)

at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:144)

at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:219)

at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:205)

at com.gts.inFlight.paxDashboard.jasperReport.PrintJasperReport.createReport(PrintJasperReport.java:40)

at com.gts.inFlight.paxDashboard.jasperReport.PrintJasperReport.<init>(PrintJasperReport.java:25)

at com.gts.inFlight.paxDashboard.jasperReport.PrintDialogAction.run(PrintDialogAction.java:47)

at com.gts.inFlight.PilPrespective$4.run(PilPrespective.java:85)

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

When you say running from main do you mean from the command line vs running the class in Eclipse as a Java Application (or are you using ant)?

 

It looks like when running in Eclipse the JRCompiler can't find the source for com.sabre.dataobjects.SeatInfo.

 

Normally the JRCompiler resolves classes like this:

http://www.jasperforge.org/sf/wiki/do/viewPage/projects.jasperreports/wiki/Tutorial_Compile

 

But Eclipse has its own build path on a project to project basis.

 

My guess is you need to either add a jar (containing the SeatInfo class) to the build path of the project containing createReport() or associate that project with the project that contains SeatInfo (provided both projects are available in Eclipse.

 

I hope this is of some help.

Link to comment
Share on other sites

Thanks for your reply.

"Running from main" mean I am running the class in Eclipse as Java appilcation.

I am NOT using ant in my project.

 

I have already added jar file (containing "SeatInfo" class) to this project and I am using it in some other class too.

 

But somehow JRCompiler is not able to find it when I call this method through eclipse application.

 

So, still my problem is not solved.

 

how can I set class path at run time so that JRCompiler can find it ?

 

I also tried using

JRProperties.setProperty( JRProperties.COMPILER_CLASSPATH, "c:\dataobjects.jar" );

 

but it also didn't work.

Link to comment
Share on other sites

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...