Jump to content
Changes to the Jaspersoft community edition download ×

Error loading Scriptlet class


a_paturi

Recommended Posts

I recently started working on iReports 1.2.8 and Scriptlets within iReports and encountered a problem when integrating my report with a Java Struts Action

class. I have a report and scriptlet created in iReport.

 

The action class throws a runtime error saying “Error loading Scriptlet classâ€. I am not sure how to resolve this issue. Do i have to specify the path to the scriptlet in my action class?

 

Any help would be greatly appreciated.

 

Thank you in advance

Link to comment
Share on other sites

  • 5 weeks later...
  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

I faced the same problem . You have to manually write the source path of the scriptlet in the jrxml . I tried doing this thru iReports but i could not . heres's the sample (part of) code .

 

 

 

 

name="source_wise_hiring"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

scriptletClass="com.projectName.reports.charts.JFreeChartScriptlet" isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="0" />

<property name="ireport.encoding" value="UTF-8" />

<import value="java.util.*" />

<import value="net.sf.jasperreports.engine.*" />

<import value="net.sf.jasperreports.engine.data.*" />

 

 

Hope this helps.

Link to comment
Share on other sites

  • 4 months later...

Hello, i`m with the same problem. But when i look into de jrxml file y see the line

scriptletClass="My_CLASS"

but when a try to use de report in my program, it trow this error:

Error Loading Scriptlet Class: My_CLASS

 

If anybody know what is the problem, please tell me.

 

Thnks

Link to comment
Share on other sites

If you are using the internal scriptlet editor (inside iReport) then the classname is relative to the directory that each of your .jrxml files are stored. (thats why there isn't a complete path)

 

If you are using an external editor, then you must include the necessary .jar files, AND the true path to the scriptlet's .class file in iReport->Options->Classpath. At least this is what I have gained by searching this forum for similar topics. Let me know if this works...

Link to comment
Share on other sites

Problem solved!!!, i did`t add into the lib the iReport.jar file.

I see that problem when i tried to compile the .jrxml file in the program and do`t use the .jasper.

 

Thansk for your help.

 

Post edited by: fzitelli, at: 2007/07/06 14:49

Post edited by: fzitelli, at: 2007/07/06 14:50

Link to comment
Share on other sites

  • 2 weeks later...

Yay! I finally got it working, so in the public interest (and for my own reference should I ever have to do this again) I'm writing down step by step things before.

 

In Eclipse, I had a package called Reports.

 

In the build path of this package, I needed to add the lib

 

iReports.jar (found in iReport-1.3.0iReport-1.3.0lib)

 

This also needs to be added in build.xml

 

<include name="iReport.jar" />

 

and

 

application.xml

 

<module>

<java>iReport.jar</java>

</module>

 

Then the .java code that calls the report needs to have

 

import it.businesslogic.*; within it.

 

For safety's sake (well, I'd tried this first), I put all my scriptlet .class and .java files in a .jar file and did the same adding to my package.

 

All working now!

 

Hope this helps anyone else who has been struggling like me.

 

Cheers

 

Di

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