Re: Cayenne can't find obj entity class?

From: Arndt Brenschede (a..iamos.de)
Date: Fri Apr 04 2003 - 11:11:29 EST

  • Next message: Denis Haskin: "Re: Cayenne can't find obj entity class?"

    Looks like a class-loader issue.

    If you have the cayenne-classes in
    the system classpath and your
    entities in another classloader,
    then the Class.forName()
    from the "system-class"
    to the application class
    cannot work.

    You must make sure that
    it's the same class loader

    regards,

    Arndt

    Denis Haskin wrote:
    > Weird... I had Cayenne (1.0a6) working in a simple command-line test
    > case, but now I'm trying to plug it into the Swing framework I've got
    > and it's not working.
    >
    > I've got the following source tree:
    >
    > src
    > --appMap
    > ----storage
    > ------AssocType.class
    > ------_AssocType.class
    >
    > and all my Cayenne config files are in the src directory.
    >
    > AssocType.map.xml includes:
    >
    > <obj-entity name="assocType" className="appMap.storage.AssocType"
    > dbEntityName="AssocTypeTable">
    > <obj-attribute name="Name" type="java.lang.String"
    > db-attribute-name="Name"/>
    > <obj-attribute name="ReverseName" type="java.lang.String"
    > db-attribute-name="ReverseName"/>
    > </obj-entity>
    >
    > but when I try to run the Swing app, I get an exception:
    >
    > org.objectstyle.cayenne.CayenneRuntimeException: Cannot find class
    > appMap.storage.AssocType.
    >
    > I walked through the code and the exception is being thrown in
    > org.objectstyle.cayenne.access.constructCache() at line 181, which
    > incluees the following comment before it:
    >
    > //CTM Should this be using
    > Configuration.getResourceLoader().loadClass(oe.getClassName()) ???
    > entityClass = Class.forName(oe.getClassName());
    >
    > Is this a known bug? Is there some way I can work around it?
    >
    > As this point my object/data mappings are suffciently trivial that I may
    > just do the bridge by hand... I've been impressed with Cayenne but if I
    > can't get beyond this...
    >
    > I haven't retried my command-line test. I'll do that when I get back
    > from a meeting.
    >
    > Thanks,
    >
    > dwh
    >
    >

    -- 
    --
    Dr. Arndt Brenschede
    DIAMOS AG
    Innovapark
    Am Limespark 2
    65843 Sulzbach
    

    Tel.: +49 (0) 61 96 - 65 06 - 134 Fax: +49 (0) 61 96 - 65 06 - 100 mobile: +49 (0) 151 151 36 134 mailto:arndt.brensched..iamos.com http://www.diamos.com



    This archive was generated by hypermail 2.0.0 : Fri Apr 04 2003 - 11:08:34 EST