Jump to content
Changes to the Jaspersoft community edition download ×

name.package.class.Scriptlet resolves to package when report with Scriptlet on Jasper server


kry_1
Go to solution Solved by Jivan Phadtare,

Recommended Posts

Hi

 

I'm trying to run a report that uses a scriptlet. I created a java file in src/com/av/jasper, then I Compiled it to a .class file and I then created a jar file out of the class file.

I included the jar for the scriptlet in the build path for the Project folder.

converted-file.png.c9888e226bf8d3f4f242b31eedd51a6d.png

converted-file.png.cee55600dec334e3f107aed26b0bc3ee.png

You can see that it's in the scr folder and Referenced Libraries.

This is the Scriptlet config:

converted-file.png.c251199a43e95b1f6bf494d3691cfd63.png

I've imported them in report jrxml like this:

 

<import value="com.av.jasper.*"/><import value="cp,.av.jasper.GetExpressionFromStringScriptlet"/><scriptlet name="GET_EXPRESSION_FROM_STRING" class="com.av.jasper.GetExpressionFromStringScriptlet"/>[/code]

I've copied the file to apache-tomcat-9.0.54/webapps/jasperserver-pro/WEB-INF/lib/GetExpressionFromStringScriptlet.jar

Then I restarted the server, but it still fails with:

ERROR SecureExceptionHandlerImpl,pool-18-thread-1:125 - There was an error on the server. Try again or contact site administrators. (Error UID: b77e9879-0351-4a3d-a1a7-a380f1d4233b). Errors were encountered when compiling report expressions class file:1. Only a type can be imported. com.av.jasper.GetExpressionFromStringScriptlet resolves to a packageimport com.av.jasper.GetExpressionFromStringScriptlet;       <-------------------------------------------->2. com.av.jasper.GetExpressionFromStringScriptlet cannot be resolved to a type                value = ((com.av.jasper.GetExpressionFromStringScriptlet)parameter_GET_EXPRESSION_FROM_STRING_SCRIPTLET.getValue()).FormatString(); //$JR_EXPR_ID=26$                          <-------------------------------------------->3. com.av.jasper.GetExpressionFromStringScriptlet cannot be resolved to a type                value = ((com.av.jasper.GetExpressionFromStringScriptlet)parameter_GET_EXPRESSION_FROM_STRING_SCRIPTLET.getValue()).FormatString(); //$JR_EXPR_ID=26$                          <-------------------------------------------->4. com.av.jasper.GetExpressionFromStringScriptlet cannot be resolved to a type                value = ((com.av.jasper.GetExpressionFromStringScriptlet)parameter_GET_EXPRESSION_FROM_STRING_SCRIPTLET.getValue()).FormatString(); //$JR_EXPR_ID=26$                          <-------------------------------------------->[/code]


I've also tried to upload the jar file as a resource for the report but it does nothing.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images


Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.

Link to comment
Share on other sites

  • Solution

Hello,

while importing the package n jrxml report, we could see it was mentioned as wrong like cp, kindly correct and republish report.
<import value="cp,.av.jasper.GetExpressionFromStringScriptlet"/>


Also, you can try editing WEB-INF/applicationContext-adhoc.xml and add the following property somewhere inside the adhocEngineService bean:
<property name="reportUnitClassLoadingEnabled" value="true"/>
Reference : https://community.tibco.com/s/article/jasperserver-unable-load-scriplet-jars-repository

Hope this will find you useful.

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