Jump to content

How to publish custom functions from Jasper Studio to the Jasper Server


ericb_1
Go to solution Solved by hozawa,

Recommended Posts

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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

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.properties
  • jasperreports_extension.properties

The 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 Export

export.png

  • Click on the src folder and check the jasperreports_extension.properties file

extprops.png

  • Click on the package folder and select everything inclucing the jasperreports_messages.properties file

msgprops.png

  • Pick the destination folder to export the new .jar file to and click finish. 

exppath.png

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 report

  • Log into Jasper Server
  • Select your report, and click Edit
  • Click Controls & Resources
  • Click Add Resource

controls.png

  • Select Upload a Local File and locate the jar file that you exported from earlier

localfile.png

  • Edit 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 same

resource.png

  • Make sure your jar file has been added to the Resources in the Controls & Resources page, then click Submit
  • Note - The devhours.jar in the image below is the Name and Resource ID that I gave it. Your resource may be called something else 

complete.png

 

Hopefully this helps others who may have had problems adding custom functions to the Jasper Server.

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