开发者

JasperReports JavaBeans set Datasource, General Error

I'm using the JasperReport开发者_StackOverflow中文版s NetBeans plugin.

I want to provide my data as a Collection of beans.

So I've done two things:

1) implemented a very simple factory class that returns the collection

public class MyFactory {
    public static Collection<Person> createBeanCollection() {
        ArrayList al = new ArrayList();
        for (int i=0; i<10; i++) {al.add(new Person());}
    return al;
    }

}

2) set up the JasperReports IDE (iReports under netbeans) to use it:

click on Report Datasources icon, the "Connection/Datasources dialog appears"

click on new, choose JavaBean set datasource: appears the dialog.

write any name in the name property, MyFactory as the Factory class, createBeanCollection as the static method.

But when you TRY the connection with the button, it gives:

"General problem:

MyFactory"

My next tests and clues are:

- write a class name that doesn't exist MyFactoryyyy ->ClassNotFound exception

so the class IS located

- write a static method name that doesn't exist createBeanCollectionnnnn ->General problem so, since the error is the same, the problem MAY be locating the method.

Any idea?

ADDED If I use, as class factory, the default Sample class provided with JasperReports, it seems to work (Connection succeded). com.jaspersoft.ireport.examples.SampleJRDataSourceFactory Now I'm searching the source code for this class.

ADDED Once restarted the IDE the problem disappares. Probably a caching problem. I won't close this question, instead i'll try to reproduce the problem and document it.


Need to define null constructor:

public MyFactory () {};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜