我想在 Jasper 报告中使用 2 个自定义类。我遵循了这个建议:JasperReports 字段的自定义类 我怎么无法让 IReport 编译报告。
编译结果:
net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :
1. java.lang.ClassNotFoundException: Will not load classes from default package (Client)
2. java.lang.ClassNotFoundException: Will not load classes from default package (User)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:271)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:153)
at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:512)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
jrxml 文件: https ://gist.github.com/4285142
我正在解析另一个类,它包含两个类的对象:
用户等级:
public class User
{
int _userId;
UserPermission _userPermission;
String _firstName;
String _lastName;
String _userName;
String _userPassword;
String _saltValue;
Date _creationDate;
Date _editedDate;
//get&setters
}
客户端类:
public class Client
{
int _clientId;
String _name;
String _address;
City _city;
long _phoneNo;
String _eMail;
Date _creationDate;
Date _editedDate;
//get&setters
}