我想在Jasper报告中使用2个自定义类。 我遵循了这个建议:Custom Class for JasperReports field 我怎么也无法让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
}