Re: Runtime Error: how to find cayenne.xml

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Feb 25 2003 - 01:02:58 EST

  • Next message: Arndt Brenschede: "Re: high-volume offline processing using cayenne?"

    Configuration class was meant to be extensible, so if default behavior
    doesn't suit the developer, subclassing is the way to go. Just make sure
    you install your own configuration by doing something like:

       Configuration.initSharedConfig(new MyConfig());

    Default implementation looks for resource named "cayenne.xml",
    "database/cayenne_config/cayenne.xml" is obviously a different resource
    and is therefore not recognized. For your custom implementation you may
    change that, for instance by using approach suggested by Holger:

        http://objectstyle.org/cayenne/lists/cayenne-devel/2003/02/0119.html

    Another, totally different approach to the same task is to keep Cayenne
    files separate from CLASSPATH locations in development, but add them to
    the final deployment jar. This is an addition introduced in 1.0a6. I use
    it all the time:

        http://objectstyle.org/cayenne/userguide/deploy/cdeploy.html

    Hope this helps.

    Andrus

    Holger Hoffstätte wrote:
    > Paul,
    >
    > some more info on your problem with packaged config files. It _should_
    > work but currently does not - I verified - and it's not really Cayenne's
    > fault. ClassLoader.getResource() does not look inside packages and will
    > only find files at the root of classpath entries, unless the resource is
    > specified with a path and that's something we currently can't do. There
    > are ways around that (I just implemented a nifty solution that does 99% of
    > what you want) but one obscure problem remains, so for the time being I
    > recommend you put the config files where they work.
    >
    > regards
    > Holger
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Feb 25 2003 - 01:04:14 EST