Built in functions not working on 8.1.1


I installed jasperserver 8.1.1 and migrated some reports. Only the discrover that the reports on the new server not work because the use build in functions like: DAYSINMONTH.

Any advice on how to fix this, is there a bug in server 8.1.1. or are jar files missing that should be in the default installation but are not there?


nick@nxswart.nl's picture
Joined: Jun 4 2019 - 10:15pm
Last seen: 5 months 6 days ago

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.

arai_4 - 5 months 6 days ago

3 Answers:

Hello! It works fine for me in my basic install of 8.1.1. I created a report with one text field in the title that evaluates that function "DAYSINMONTH(new java.util.Date(03/01/2023))" and when I preview in Studio, it outputs 31. I then published to my JRS 8.1.1 and it also outputs 31 as expected. How are you running it? It IS possible you are missing a jar - we use JODA to calculate most of our time-based built-in functions. Do you have the joda-time-2.2.jar and joda-convert-1.3.1.jar jars in your lib directory? Are you running with JRS or are you using the library directly? I would make sure you have those jars. Good luck!

mbielkiewicz's picture
Joined: Feb 23 2014 - 9:22pm
Last seen: 5 days 17 hours ago

I did a clean install on ubuntu 22.04 I have a java.sql.date. So I'm doing: DAYSINMONTH($F{EndDate}) and the EndDate is mapped to a field from a json file with the type java.sql.date. I have both the joda-convert-1.3.1.jar and the joda-time-2.2.jar file in the lib folder. Probably you did not do a linux install right? I will set up a new VPS and install again the latest version and let you know if I have the problem again. If so than the problem is within the linux installer.


nick@nxswart.nl's picture
Joined: Jun 4 2019 - 10:15pm
Last seen: 5 months 6 days ago

Alright just did a new linux installation, created a blank report with only your code and the error that I get:

2023-04-17T17:40:40,510 ERROR SecureExceptionHandlerImpl,pool-9-thread-3:125 - There was an error on the server. Try again or contact site administrators. (Error UID: 2de27cbd-da38-43ba-8204-c01b12afb788). Could not find matching constructor for: java.util.Date(BigDecimal) net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: DAYSINMONTH(new java.util.Date(03/01/2023))

So there is a problem in the linux installation.

The steps I did:

apt-get update
sudo apt install chromium-browser
wget -O jasperserver.run "https:/"
chmod +x jasperserver.run
sudo ./jasperserver.run
ufw allow 8080
cd /opt/jasperreports-server-cp-8.1.1
 ./ctlscript.sh start

Then I call the report by the rest api with a json string cast to the data bundle

nick@nxswart.nl's picture
Joined: Jun 4 2019 - 10:15pm
Last seen: 5 months 6 days ago