kry_1 Posted March 31, 2023 Share Posted March 31, 2023 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.You can see that it's in the scr folder and Referenced Libraries.This is the Scriptlet config: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.jarThen 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 More sharing options...
Mehak Rajkumar Posted April 3, 2023 Share Posted April 3, 2023 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 More sharing options...
Solution Jivan Phadtare Posted April 3, 2023 Solution Share Posted April 3, 2023 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-repositoryHope this will find you useful. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now