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

Java Type mismatch Error within iReport


joshuab

Recommended Posts

Hi,

I'm very new to iReport and I've been given a Jasper report template and a Java datasource to start editing. I've been given instructions on how to setup iReport however when I follow the instructions, I get a number of "Type mismatch: cannot convert from boolean to Object" errors generated when I try to Preview the template.

I'm running iReport 5.6.0 on Mac OS X 10.9 and running with JDK 7.65, I've tried changing the JDK version but it hasn't made any difference to the errors.

The really strange thing is that I have given the template and datasource to a couple of other developers and talked them through the instructions (so that they followed the exact same steps as I did). One of them is running in OS X and the other running in Windows 7. Both of these developers were able to use the template and Preview it without getting the same problems that I've been having.

I've tried a number of things (reinstalled iReport, changed JDK, turned my computer on and off, sacrificed a goat) but I keep on getting these errors.

Has anyone seen this error before and have any ideas about what could be causing this error on my machine, while other developers got it working first time (following the exact same steps)?

Thanks.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hi thanks for your response, some more details on my question:

 

The field is called invoiceHeader and it's type is a Java object.

The text field that's generating the error has a Text Field expression which is: $F{invoiceHeader}.getInvoiceId()

The text field Expression Class is: java.lang.String

 

The error being generated is:

Type mismatch: cannot convert from long to Object.

 

The Java method .getInvoiceId() returns a long, which explains part of the error. But what is unclear to me is why iReport Studio is expecting an Object to be returned.

 

Also, as I posted originally, this error is not occurring in other developers environments.

 

Thanks again for your help.

Link to comment
Share on other sites

It is wrong (or not full) description of problem.

In first message you say about "Type mismatch: cannot convert from boolean to Object"

Now: "Type mismatch: cannot convert from long to Object."

Why you wrote about difference errors?

 

You don't show stacktrace. You don't show definition $F{invoiceHeader} in jrxml.

Telepaths are on vacation :)

 

Probably you can try change getInvoiceId() {return long} to getInvoiceId() {return Long}

 

But this is only an attempt to guess without seeing anything

 

 

 

 

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