RE: Newbie question on Cayenne error at runtime

From: McBrayer, Roy (Roy.McBraye..ail.va.gov)
Date: Wed Jul 14 2004 - 10:14:36 EDT

  • Next message: Jonathan Carlson: "New data model creation"

    My specific problem is that the iiv_test.SiteDailySum is indicated as an
    error when entered as given

    Configuration.bootstrapSharedConfiguration(iiv_test.SiteDailySum);

    This is my source code. All of my java source that extends the interfaces
    is in the iiv_test package. All of the interfaces are in the auto package.
    I have a CreateReport class that I am using to query the SiteDailySum table.
    This is the class that is given below.

    CreateReport.java
    ///////////////////////

    package iiv_test;

    import org.objectstyle.cayenne.access.*;
    import org.objectstyle.cayenne.query.*;
    import java.util.*;
    import org.objectstyle.cayenne.conf.*;

    public class CreateReport {
      public CreateReport() {
        
       
        
      }
      public static void main(String[] args) {
        CreateReport CreateReport1 = new CreateReport();
       
        CreateReport1.cayenneReport1();
      }

      public void cayenneReport1()
      {
        DataContext ctxt =DataContext.createDataContext();

        SiteDailySum sdm = new SiteDailySum();
        
        ctxt.registerNewObject(sdm);
        

        SelectQuery query = new SelectQuery(SiteDailySum.class);
        List records = ctxt.performQuery(query);
        int length =records.size();
        System.out.println("This is the number of records " + length);
      }

    }

    -----Original Message-----
    From: McBrayer, Roy
    Sent: Wednesday, July 14, 2004 8:09 AM
    To: cayenne-use..bjectstyle.org
    Subject: RE: Newbie question on Cayenne error at runtime

    I have been unable to figure out where to put the statement

    Configuration.bootstrapSharedConfiguration(iiv_test.SiteDailySum);

    within my code. Where should this be located? In the main method?

    Also, what causes this problem? Is there any setting within the Modeler
    that will avoid it?

    Thanks,
    Roy McBrayer

    -----Original Message-----
    From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Sent: Tuesday, July 13, 2004 5:26 PM
    To: cayenne-use..bjectstyle.org
    Subject: Re: Newbie question on Cayenne error at runtime

    Hi Roy,

    This looks like a nested ClassLoader issue recently discussed on the
    list -
    http://objectstyle.org/cayenne/lists/cayenne-user/2004/07/0047.html

    The solution is either load cayenne.jar using the same class loader as
    the one used for the application classes (in case of web app, this
    simply means putting cayenne.jar in the web app WEB-INF/lib/
    directory), or bootstrap cayenne with appropriate class loader
    explicitly:

    Configuration.bootstrapSharedConfiguration(iiv_test.SiteDailySum);

    The first solution is cleaner, but you don't always have a choice...

    Andrus

    On Jul 13, 2004, at 5:09 PM, McBrayer, Roy wrote:
    > I am getting this error when trying to run a simple Cayenne based
    > project.
    > It builds just fine but when I try to run it I get the following.
    >
    >
    > java.lang.IllegalArgumentException: Can't find ObjEntity for DataObject
    > class: iiv_test.SiteDailySum, class is likely not mapped. at
    > org.objectstyle.cayenne.access.DataContext.registerNewObject(DataContex
    > t.jav
    > a:889) at iiv_test.CreateReport.createReport1(CreateReport.java:20)

    > at
    > iiv_test.CreateReport.main(CreateReport.java:12) Exception in thread
    > "main"
    >
    >
    > I am also getting a long list of warnings like
    >
    > WARN EntityResolver: *** Class 'XplSdw' not found in runtime.
    > Ignoring.
    >
    >
    >
    > I have created all of my Java source code and the 3 xml files.
    >
    > What else do I need to do?
    >
    > Roy McBrayer
    > Dept. of Veteran's Affairs
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Jul 14 2004 - 10:14:39 EDT