Jump to content
Changes to the Jaspersoft community edition download ×

Hello World Scriptlet Example:Error "cannot be resolved to a type"


dstevens_2

Recommended Posts

I am trying to follow the tutorial Hello World Scriptlet Example by Sadakar Pochampalli.

After following all the instructions, once i try to compile and run the report i get the error below.

Help greatly appreciated!!

    net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
    1. com.sadakar.jasper.Test4 cannot be resolved to a type
                value = ((com.sadakar.jasper.Test4)parameter_Hello_SCRIPTLET.getValue()).hello(); //$JR_EXPR_ID=8$
                          <---------------------->
    2. com.sadakar.jasper.Test4 cannot be resolved to a type
                value = ((com.sadakar.jasper.Test4)parameter_Hello_SCRIPTLET.getValue()).hello(); //$JR_EXPR_ID=8$
                          <---------------------->
    3. com.sadakar.jasper.Test4 cannot be resolved to a type
                value = ((com.sadakar.jasper.Test4)parameter_Hello_SCRIPTLET.getValue()).hello(); //$JR_EXPR_ID=8$
                         <---------------------->
    3 errors
        at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:206)
        at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:294)
        at com.jaspersoft.studio.editor.preview.view.control.ReportControler.compileJasperDesign(ReportControler.java:465)
        at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$15(ReportControler.java:442)
        at com.jaspersoft.studio.editor.preview.view.control.ReportControler$5.run(ReportControler.java:356)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

I remembered getting issues following this example too... whether or not its exactly this error but I think it was similar. 

I believe there's a mistake in one of the steps.. 

3) Add Jasper Server jar file to Project Path

This step applies to the Java project.. The jar file mentioned is 'Jar File Name : jasperreports-pro-6.0.0.jar' but this is not right. It should be jasperreports-6.3.0.jar (for 6.3) or  jasperreports-6.2.0.jar as per the screenshot in the following step. 

As my Studio is not where the server is, I copied the  jasperreports-6.3.0.jar from server and place it locally and load that in the project path. 

Step 5 and 6a are important. Once you have exported your test.jar, step 6a should be done for "MyReports" not for the java project.

Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...
  • 1 year later...

I was tearing my hair out over this as well.  In my case, the problem was that it simply doesn't work in Jaspersoft Studio (Community Edition) 6.17.0, and reverting to 6.16.0 fixed it.  I don't know if this is the same bug mentioned for the Enterprise edition version 7.3.1: https://community.jaspersoft.com/wiki/scriplet-class-cannot-be-resolved-type-tibco-jaspersoft-studio-731

Also, a slight update to Sadakar Pochampalli's instructions... step 6a should now read:

Right Click on "My Reports" Project -> Build Path -> Configure Build Path -> Libraries -> Classpath -> Add External JARs ->("test" jar from your exported location from Eclipse) -> Apply and close

Link to comment
Share on other sites

  • 3 months later...

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