[#3972] - User Functions don't work in community edition UPDATE- Neither in 6.0.0

Category:
Bug report
Priority:
High
Status:
Resolved
Project: Severity:
Major
Resolution:
Fixed
Component: Reproducibility:
Sometimes
Assigned to:
0

Hi Guys,

I've spend a whole day now to try and add custom userfunctions to my project, but I don't succeed in any way. It should not be that hard: I've followed the steps desribed in the URL here below:

https://community.jaspersoft.com/wiki/jaspersoft-studio-expression-edito...

When I follow the steps with the community edition it does not work. The custom functions (like HELLO_WORLD) don't show up in the expression editor and throw an exception when trying to preview.. Exception can be found at the end of this message.

After a dozen attemps on different ways (through scriplest; they don't open) and mostly on the officiel way. I tried to use the pro edition which was on my laptop from 2 monts ago and it worked at once. After that I tried some more things:

* Create a new workspace with community
* Uninstall pro edition
* Reinstall (uninstall and install) community edition

But they all don't work and I'm stuck here with no way to use custom functions.

I love to hear from you guys. Have a great day and thanks in advance!

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : HELLO_WORLD_MSG( )

at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:467)

at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:442)

at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:334)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : HELLO_WORLD_MSG( )

at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:263)

at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:611)

at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:579)

at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1016)

at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:504)

at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:488)

at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)

at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2067)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:788)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:298)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:152)

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963)

at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)

at java.lang.Thread.run(Unknown Source)

Caused by: net.sf.jasperreports.engine.JRRuntimeException: Function HELLO_WORLD_MSG not found

at net.sf.jasperreports.compilers.GroovyEvaluator.functionCall(GroovyEvaluator.java:76)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)

at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)

at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)

at SampleFunctions_1416835410257_590303.methodMissing(calculator_SampleFunctions_1416835410257_590303:22)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)

at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:832)

at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1123)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1076)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904)

at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)

at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:137)

at SampleFunctions_1416835410257_590303.evaluate(calculator_SampleFunctions_1416835410257_590303:160)

at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250)

... 14 more

AttachmentSize
Package icon issueDetails.zip4.58 KB
gert_1's picture
220
Joined: Aug 7 2014 - 12:25am
Last seen: 5 years 11 months ago

17 Comments:

#1
  • Assigned:nobody»

I too spent a very frustrating day trying to get custom functions working in 5.6.2 without any success. I installed 5.5.2 and I saw the custom functions in the expression editor, I then installed 5.6.1 and again all was well.

This is a bug in 5.6.2. If you use custom functions do not use 5.6.2, use 5.6.1 and it will work.

#2
  • Severity:Critical» Block
  • Assigned:nobody»

As declared in the title: Still happening with 6.0.0 final which I downloaded minutes ago

#3
  • Status:New» Confirmed
  • Assigned:» mrabbi

We will look and fix for next version. It could be related to a recently introduced caching mechanism for JasperReports extension.
After a Jaspersoft Studio restart are you able to see the functions appear in the editor?

#4

I have the same problem with 5.6.1 and restarting the Studio does not help:
Neither the sample functions and additional function created by myself are available.

Only after some time, changes at the sample functions appear in the sample report. But my own functions never appear.

#5

I think it's solved now? It works for me in 6.0.3 I believe so I can be closed then :)

#6
  • Resolution:Open» Fixed
  • Status:Confirmed» Resolved

Hi,
thanks for bringing it up. I thought it was already closed :)
Probably I missed it.

Thanks.
Regards,
Massimo.

#7

I just tried with Community Edition 6.0.3 and got the same error.
@mrabbi: Which version should fix this bug?

Oddly, it works in 5.6.1, but there, I have another problem already reported before:
http://community.jaspersoft.com/questions/841321/have-restart-jaspersoft...

Where are the function referenced cached in the workspace? I even created a new library project with a sample report, but it somehow used different versions of another library project.

The solution according to another post is to register the new functions, but the example functions should be already available in 6.0.3 as they are in 5.6.1:
https://community.jaspersoft.com/questions/848371/custom-functions

As I already have lost a lot of time with trial and error, I really hope for some hints :)

#8

Hello.

I use version 6.0.4.final (the latest when I installed it few days ago) and I have exactly this problem.

- After running the library wizard the custom functions are unknown of the studio.
- If I restart the studio, they are found.

#9

I just downloaded the latest version 6.3.0 and got exactly the same issue, anyone have any ideas if the issue have been solved?

#10

I'm working with version 6.3.1.final and the bug remains.

#11
  • Reproducibility:Always» Sometimes
  • Resolution:Fixed» Reopened
  • Status:Resolved» New

hi, all.
Everyone, who couldn't get it to work, try the following workaround:
1. Press Ctrl+B additionally to re-build all projects
2. Restart JSS
But bug remains, because it still doesn't work without this workaround. Reopening.

#12
  • Priority:High» Normal
  • Severity:Block» Major
#13

Confirm that Ctrl+B is helping in 6.3.1

#14
  • Resolution:Reopened» Fixed
  • Status:New» Resolved

Fixed the issue with Functions library. The fix also solves issues related to the general development in Jaspersoft Studio, for example when using the scriptlets or some data adapter related classes directly in JSS (via src folder).

#15

I am using 6.6.0 Community Edition and have this issue. I have modified the "jasper Studio.ini" file and replaced the bundled JRE with the one installed on my local PC separately under the "-vm" entry and this at least allowed the dummy "HELLO_WORLD", etc. functions to now work and show up in the expression editor but any new functions I add will NOT show up in the editor. I have simply copy-and-pasted the "HELLO_WORLD" function and gave it a different name to test things out and it will not show and *intially* would not work at all even after rebuilding. Oddly it would not rebuild the class file for the custom library AT ALL when I first started trying to add my own functions unless I modified the dummy ones that are automatically generated by JS. Eventually the new function I added (the renamed "HELLO_WORLD" function that I copied and pasted) *DID* work after a couple of restarts (I can manually enter it as an expression and when running the report it works) but it STILL does not show up in the expression editor.

One last tidbit - prior to all of this I had an expression I manually wrote into a text field that I eventually completely removed (text field and all) and for the next few days every time I would start JS it would immediately report errors in the "Problems" tab referencing this non-existent field and expression. Somehow it was holding on to this errant field yet I could NOT find any trace of it within the files on my computer (I literally used a utility to search the text in every file on my system) nor could I find something in the registry either.

Something is going on with this thing and apparently has since version 5.6.2 as I've found all kinds of people with the same issue and none with any real answers. I am evaluating this right now as my company is considering moving to Jasper Reports as opposed to Oracle's BI Publisher and if this is what we can expect there is no way I would pay all of the money they charge for the commercial version of this.

The fact that this has gone on for so long unaddressed is extremely discouraging.

#16
  • Priority:Normal» High
  • Resolution:Fixed» Reopened
  • Status:Resolved» Confirmed
  • Assigned:nobody»

I know that this is an old post, but I still have this same issue with version 6.16.0.
Adding a new function into the generated sample java file works even if it doesn't show in the Expression Editor list of available functions: you can add a field to the sample report that uses your new custom function (manually edited) and the report is correctly displaying the result.
But most of the time you need to recompile and build the whole project, sometimes the CTRL+B helps, others you need to close and restart Jaspersoft Studio.
If you try to rename the two sample functions in the generated java file (using the "Refactor-->Rename" menu of the environment and manually update accordingly the jasperreports_messages.properties file with the new name), the two functions appear in the Expression Editor, but only those two and no other function you may have added into the java file.

#17
  • Resolution:Reopened» Fixed
  • Status:Confirmed» Resolved

Hi, I've attached a patch in the following bug (duplicate for this) that should solve the issue (version 6.17.0): https://community.jaspersoft.com/jaspersoft-studio/issues/13591#comment-...

Best regards,
Massimo.

Feedback
randomness