Jump to content
We've recently updated our Privacy Statement, available here ×

Problem generating report - JR 3.6.0


burferd

Recommended Posts

I'm using JasperReports 3.6.0 and iReport 3.5.3, NetBeans6.5.1 and Glassfish 2.0

I have a report that works fine in iReport, but when I attempt to run it from my application, I get the following exception when calling the JasperFillManager.fillReport() method to create the report:

"cannot assign instance of net.sf.jasperreports.engine.base.JRBaseStaticText to field net.sf.jasperreports.engine.base.JRBaseLineBox.boxContainer of type net.sf.jasperreports.engine.JRBoxContainer in instance of net.sf.jasperreports.engine.base.JRBaseLineBox"

It kind of sounds like something in the report itself is trying to use the wrong type of component, but I know virtually nothing about Jasper Reports.

Does anyone have an idea what is causing this?

Let me know if I need to post any additional information or code.

Thanks.

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

I'm bringing this up again since I did not recieve any feedback on   my last post.

I have added jrxml version of the report I am attempting to run as an attachment.

 

I have also included the code I am using to create the report in my application.

 

The report gives the exception noted in my last post when it attempts to create the report in the following line of code:

 

jp = JasperFillManager.fillReport( sb1.getReportDir()+"Company_Report.jasper", parameters, conn );
 

The error message is:

 

"cannot assign instance of net.sf.jasperreports.engine.base.JRBaseStaticText to field net.sf.jasperreports.engine.base.JRBaseLineBox.boxContainer of type net.sf.jasperreports.engine.JRBoxContainer in instance of net.sf.jasperreports.engine.base.JRBaseLineBox"

 

I do not understand how the report can run in iReport, but have problems in the application.

Maybe there is a missng library?

Here are the libraries I am linking to in the application:

commons-beanutils-1.8.0.jar

commons-collections-2.1.1.jar

commons-digester-1.7.jar

commons-logging-1.0.4.jar

iText-2.1.0.jar

jasperreports-3.6.0.jar

jfreechart-1.0.12.jar

poi-3.2-FINAL-20081919.jar

 

I'm at a standstill until I can figure out what the problem is here.

Any help is appreciated

Thanks.

 

 

Code:
    public boolean createCompanyRpt()    {        JasperPrint jp=null;        JasperReport jr = null;        try        {            String title = "Tag Enrollment Report";            Map parameters = new HashMap();            String dir = sb1.getReportDir();            jp = JasperFillManager.fillReport( sb1.getReportDir()+"Company_Report.jasper", parameters, conn );            if( doPdf )doPdfReport( jp, "CompanyReport");            if( doExcel )doExcelReport( jp, "CompanyReport" );        }        catch( Exception e )        {            e.printStackTrace();            log( "<ReportSessionBean.createCompanyRpt> Error: "+ e.toString());            sb1.setMessage( "Error creating report.");            return false;        }        return true;    }
Link to comment
Share on other sites

  • 4 weeks later...

The problem was that in the bowels of NetBeans, the older Jasper Reports libraries were being referenced.

This, apparently caused some confusion.   It looks like there is a change between the Jasper Reports libraries - not backward compatible.

I was not able to resolve this by changing libraries in the NetBeans IDE library manager, but had to ferret it out in the internal setup files for NetBeans.

Not sure exactly how I found it, but if you do a project search for the old library name, you might find a reference that you can delete.

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