Jump to content
Changes to the Jaspersoft community edition download ×

How to use my own class in reports (iReports 3.5.2


yelnaza

Recommended Posts

Hi to all

I have a problem in my report.

I need to use custom class in it, but I don't know how to.

I tried to put path to jar file with my class file into CLASSPATH, tried to set my jar file in iReports- Tools - Options - CLASSPATH

but my report doesn't work. It compiles prefectly but doesn't fill data. I have this error:  java.lang.IllegalAccessError and message that my class can't be accessed from reports class.

Can anyone help me, please

Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

this is a good question...

but there is something unclear when you describe your issue:

"It compiles prefectly but doesn't fill data. I have this error:  java.lang.IllegalAccessError and message that my class can't be accessed from reports class."

how it can compile perfectly also giving you an error?
can you be more clear (maybe reporting the exact error...) ?

listening:     Marlene Kuntz - Impressioni di settembre

 

 



Post Edited by slow at 08/23/2010 14:30
Link to comment
Share on other sites

Ok, when I said "compile prefeclty" I mean that when I go from Designer to Preview everything is ok.

When I try to run report with my parameter value  it  is crushing and log file said that filling report is impossible becouse report class can't access  to my class.

Link to comment
Share on other sites

have you tried the same report on two computer? not similar report, but exactly the same...



you can also try to import your class... (it's a bean class, an help class or what else?)


clicking on the main node of your report and then in the properties window on the "import" button setting the package of your class.



I use custom class but I'm not having problem.

Link to comment
Share on other sites

I try to make new report with text field in it. In expression of text field I create new object of my class. On one computer it works, on another don't work's and log says:

 

 Compiling to file... C:\Jasper\report1.jasper

Compilation running time: 281!

Setting net.sf.jasperreports.engine.query.JRJdbcQueryExecuterFactory as Query Executer Factory for language: sql

 Filling report...

 Locale: руÑÑкий (РоÑÑиÑ)

 Time zone: Default

Error filling print... Error evaluating expression :      Source text : new InWords("1234").toString()

net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : new InWords("1234").toString()      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557)      at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929)      at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383)      at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)      at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)      at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:325)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:261)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:127)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:942)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:860)      at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:540)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:914)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)  Caused by: java.lang.IllegalAccessError: tried to access class InWords from class report32name_1282642047542_741168      at report32name_1282642047542_741168.evaluate(report32name_1282642047542_741168:164)      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182)      ... 18 more 

Print not filled. Try to use an EmptyDataSource...

 

 

Link to comment
Share on other sites

from russia... wow :)

try to import your class as I have explained in the previous post, then, in the texfield use the expression:

(new InWords("1234")).toString() 

and not

new InWords("1234").toString() 

check if the cell type of the textfield is String

 

it seems to be a JVM problem...
have the two machines where you run the report the same JVM?

 

make a test and then give us a feedback :)

 

listening :

Marlene Kuntz - Sonica

Post Edited by slow at 08/24/2010 09:40
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...