How to install custom expression on server

I created a custom expression function by following the instructions here: https://community.jaspersoft.com/wiki/jaspersoft-studio-expression-editor-how-extend-it-and-contribute-your-own-functions-part-2-0  

This works fine and I can preview a report using the custom expression in JSS 6.5.1.   Now, how do I install the expression on the server?  I can create and upload a jar, but that in itself is not enough.  I see various mention of bundles, spring beans, and so on, but the information seems either outdated or irrelevant.  Is there a "Part 3" to the tutorial above that shows how to install the extended expression on the server?

jphiloon's picture
111
Joined: Nov 9 2017 - 6:19am
Last seen: 4 years 11 months ago

The problem as per the log is

2018-02-06 13:44:55,324 ERROR GenericExceptionMapper,http-nio-8080-exec-2:50 - Unexpected error occurs
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. The method CSS2HTML(String) is undefined for the type Comments_1517942694193_850454
                value = CSS2HTML(((java.lang.String)field_COMMENT.getValue()) ); //$JR_EXPR_ID=21$

 

jphiloon - 5 years 3 months ago

2 Answers:

I'm not using this interface for custom functions. My recomendation would be to write custom java class with needed methods, download jar file to server and use it as scriptlet in report. Example can be found here. Procs of this approach is in scalability.

sergey.vishnevetskiy's picture
Joined: Jan 2 2018 - 10:13am
Last seen: 2 years 12 months ago

I got the server working by: a) copying up the jar that contained the custom expression, b) modifying the .jrxml file to import the custom class and c) also qualifying the CCS2HTML expression as per  <textFieldExpression><![CDATA[Util.CSS2HTML($F{COMMENT} )]]></textFieldExpression>

jphiloon's picture
111
Joined: Nov 9 2017 - 6:19am
Last seen: 4 years 11 months ago
Feedback
randomness