yeah ClassLoader wierdness caused by me I'd say. I had the Cayenne jars
in the iReports CP and my application jars in the "internal" IReports CP
(you can set a CP inside iRep's which of course must load under another
ClassLoader).
What really gave it away was:
ObjEntity e =
dataContext.getEntityResolver().lookupObjEntity("MyEntityName");
e.getJavaClass() --->> throws a java.lang.ClassNotFoundException
I think iReports just doesn't quite seem to be there yet, especially
with Bean datasources. For all the extra effort involved in getting it
wired with Cayenne it seems to be easier to just use the reporting
engine to call the DB directly, expecially in my case with using stored
procs. I've thought about using XML datasource but why throw all that
extra processing in? The reason I thought to go down the Bean
datasource with Cayenne was for consistency with the rest of the apps
here and all the pooling and caching options...
Thanks anyway for your help Andrus.
-- http://www.fastmail.fm - Or how I learned to stop worrying and love email again----- Original message ----- From: "Andrus Adamchik" <andru..bjectstyle.org> To: cayenne-use..bjectstyle.org Date: Mon, 16 Jan 2006 18:16:42 -0500 Subject: Re: iReport/Cayenne integration
> It appears to me that there is a problem with the DataMaps hence the > entity's can't be resolved?
Right on... or more likely there is some ClassLoader weirdness making Cayenne believe that the class is not mapped. Can you put a debug statement before calling 'objectsFromDataRows' to make sure the entity in question is present and is actually mapped to a fully qualified class name of RptInvoicesErroredToDate?
Something along the lines:
ObjEntity e = dataContext.getEntityResolver().lookupObjEntity ("string_entity_name"); String className = e.getClassName(); System.out.println(...);
Andrus
On Jan 16, 2006, at 12:59 AM, Steve Wells wrote:
> After a bit of effort I've nearly got iReport's (GUI for Jasper > Reports) > JavaBean DataSource connection working to a Cayenne (M9) object. > Sadly > now I get this: > java.lang.NullPointerException > at > org.objectstyle.cayenne.access.ObjectResolver.<init> > (ObjectResolver.java:98) > at > > org.objectstyle.cayenne.access.DataContext.objectsFromDataRows > (DataContext.java:682) > at > > org.objectstyle.cayenne.access.DataContext.objectsFromDataRows > (DataContext.java:701) > at > RptInvoicesErroredToDate.getReportData > (RptInvoicesErroredToDate.java:34) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke > (NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at > > it.businesslogic.ireport.gui.ConnectionDialog.jButtonOK1ActionPerforme > d(ConnectionDialog.java:834) > > The calling code (RptInvoicesErroredToDate): > public static List getReportData() throws DBException { > DataContext dataContext = DataContext.createDataContext(); > > // Get a handle to the stored proc > final ProcedureQuery query = new > ProcedureQuery("rpt_invoices_errored_to_date"); > > List list = new ArrayList<RptInvoicesErroredToDate>(); > try { > > // Run the report and get the results > final List rows = dataContext.performQuery(query); > // Because we get raw rows from the stored proc transform > them into the correct object types (in the list) > list = > dataContext.objectsFromDataRows > (RptInvoicesErroredToDate.class, > rows, false, false); > } catch (Exception e) { > throw new DBException("Could not get report data", e); > } > return list; > } > > With the JavaBean connection you supply a Factory and static method to > call. I'd like to use this method over Jasper/JDBC or XML > datasources. > > All this works properly though from my test harness. > > It appears to me that there is a problem with the DataMaps hence the > entity's can't be resolved? > > If anyone has any pointers to the problem, I'd be grateful. > > Thanks.
This archive was generated by hypermail 2.0.0 : Mon Jan 16 2006 - 19:17:42 EST