simon.lischka Posted June 17, 2015 Share Posted June 17, 2015 I'm running into a problem with Jaspersoft Studio. I had a working project with a library defining custom conversion functions. Lately my .jrxml views don't find my functions anymore. When clicking on preview of *file1.jrxml* in folder *[PROJ_ROOT]/set1*, following error message is thrown: "The method AUTO_CONVERT(String) is undefined for the type file1_1434540912649_515329" AUTO_CONVERT is located in *[PROJ_ROOT]/src/de/companyname/packagename/MyClass.java*, all variables passed to it are of type String. Sample from MyClass.java: package de.companyname.packagename; .. @FunctionCategories({ de.companyname.packagename.MyClass.class }) public class MyClass { .. @Function("AUTO_CONVERT") @FunctionParameters({ @FunctionParameter("aString") }) public static String AUTO_CONVERT(String aString) { ... The jasperreports_messages.properties file is in [PROJ_ROOT]/src with content (also tried moving it to same dir as Myclass): de.companyname.packagename.MyClass.name = MyClass de.companyname.packagename.MyClass.description=Custom Functions de.companyname.packagename.MyClass.AUTO_CONVERT.name = Auto Convert de.companyname.packagename.MyClass.AUTO_CONVERT.description= Descr jasperreports_extension.properties, also in [PROJ_ROOT]/src: net.sf.jasperreports.extension.registry.factory.functions=net.sf.jasperreports.functions.FunctionsRegistryFactory net.sf.jasperreports.extension.functions.test=test Previously I managed to fix these kind of problems by modifying the build path settings and simply adding the project root ( which doesn't change anything now ). My functions don't appear in the expression editor. JasperSoft also seems to have some kind of problem "acknowleding" my src folder. Instead of displaying a folder like src directory in the Project Explorer and *de/companyname/packagename* as subelement, it now displays *src/de/companyname/packagename* as one single element. My classes packagenames are marked red and expect src as a prefix (*src.de.companyname.packagename* instead of *de.companyname.packagename*) I can trick JasperSoft into "acknowleding" the src folder by chosing New->SourceFolder in the project root, but this gets changed back by some JasperSoft magic after a while. Moving to de/companyname/packagename and working without src fixes the packagename issues, but still my views don't recognize my custom classes. My class path looks like this: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path=""/> <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry exported="true" kind="con" path="net.sf.jasperreports.JR_CONTAINER"/> <classpathentry exported="true" kind="con" path="com.jaspersoft.server.JRS_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> Anyone have an idea what may be going wrong and how to fix this? I'm pretty sure it must be something with the project setup. Simply creating a new one didn't help either. Strangely when I chose the FunctionsLibrary wizard and have JSoft create example methods + a sample report, the expected hello world function fails with a JRExpressionEvalException for the Hello World message. If relevant - sloppy example or my mistake? Thanks Update: I fixed the strange src folder behaviour by doing this: .classpath: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry excluding="src/" kind="src" path=""/> <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry exported="true" kind="con" path="net.sf.jasperreports.JR_CONTAINER"/> <classpathentry exported="true" kind="con" path="com.jaspersoft.server.JRS_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> 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