ericb_1 Posted March 29, 2018 Share Posted March 29, 2018 Hello, I was able to create custom functions in Jasper Studio, and they work on my computer when I test the reports. But when I published the report to the Jasper server I get an error like this Errors were encountered when compiling report expressions class file: 1. The method CURRENT_MONTH_BEGINNING() is undefined for the type TotalTaskHrsOnly... What is the proper way to include the custom functions that I made, so that the report works when making a request to the Jasper server? If anyone can provide me with a tutorial on how to do this, that would be great. Thank you Link to comment Share on other sites More sharing options...
mlopez_1 Posted March 30, 2018 Share Posted March 30, 2018 Using scriplets works well for me.Take a look at: https://community.jaspersoft.com/blog/all-you-want-know-about-scriptletsMariano Link to comment Share on other sites More sharing options...
Solution hozawa Posted April 1, 2018 Solution Share Posted April 1, 2018 Take a look at this question. You need to export your custom function as jar file and uploading the jar file to JasperReports Server.https://community.jaspersoft.com/questions/1038286/reports-jasper-server-no-longer-see-custom-functions-jar-resource Link to comment Share on other sites More sharing options...
ericb_1 Posted April 2, 2018 Author Share Posted April 2, 2018 The reason why my custom functions were not working was because I did not export the 2 properties files that are generated when creating new library functions.jasperreports_messages.propertiesjasperreports_extension.propertiesThe steps that I took to add my new functions to the Jasper server are here:Create the jar file. Right click on your Jasper project in Jasper Studio, and select ExportClick on the src folder and check the jasperreports_extension.properties fileClick on the package folder and select everything inclucing the jasperreports_messages.properties filePick the destination folder to export the new .jar file to and click finish. Once the jar file is exported, you will need to log into the Jasper Server, and add the jar file as a resource to the reportLog into Jasper ServerSelect your report, and click EditClick Controls & ResourcesClick Add ResourceSelect Upload a Local File and locate the jar file that you exported from earlierEdit your resource Name and Resource ID, then click Next on the bottom of your browser.Note - The resource name and id are defaulted to be the sameMake sure your jar file has been added to the Resources in the Controls & Resources page, then click SubmitNote - The devhours.jar in the image below is the Name and Resource ID that I gave it. Your resource may be called something else Hopefully this helps others who may have had problems adding custom functions to the Jasper Server. 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