Re: Runtime Error: how to find cayenne.xml

From: Holger Hoffstätte (holge..izards.de)
Date: Mon Feb 24 2003 - 20:26:57 EST

  • Next message: Holger Hoffstätte: "Re: Runtime Error: how to find cayenne.xml"

    Holger Hoffstätte wrote:
    >
    > I wrote:
    > > ...
    > > there's something else wrong. For a workaround try to use something like
    > > domain = Configuration.initSharedConfig(new
    > > DefaultConfiguration("/path/to/caynenne.xml")) which will use a file path
    > > directly.
    >
    > That should be new DefaultConfiguration(new File(..)), of course. But
    > there really seems to be something fishy deep down there, since this works
    > if the files are on the top level of the classpath, but not in a
    > subdirectory. will investigate..

    I found the reason: when using new DefaultConfiguration(File), the
    DataSource cannot be loaded because the path information from the main
    config is lost; it's only available in DefaultConfiguration, not in
    Configuration or the RuntimeLoadDelegate:
    [main 02-25 02:04:17] DEBUG RuntimeLoadDelegate: Started configuration
    loading.
    [main 02-25 02:04:17] DEBUG RuntimeLoadDelegate: loaded domain: Playground
    [main 02-25 02:04:17] DEBUG RuntimeLoadDelegate: loaded <map
    name='Playground' location='Playground.map.xml'>.
    [main 02-25 02:04:17] DEBUG RuntimeLoadDelegate: loading <node
    name='Playground' datasource='Playground.driver.xml'
    factory='org.objectstyle.cayenne.conf.DriverDataSourceFactory'>.
    [main 02-25 02:04:17] DEBUG RuntimeLoadDelegate: using factory:
    org.objectstyle.cayenne.conf.DriverDataSourceFactory
    [main 02-25 02:04:17] DEBUG DriverDataSourceFactory: loading driver
    information from (Playground.driver.xml).
    [main 02-25 02:04:17] DEBUG DriverDataSourceFactory: location not found in
    filesystem.
    [main 02-25 02:04:17] DEBUG DriverDataSourceFactory: error: location not
    found.
    [main 02-25 02:04:17] DEBUG RuntimeLoadDelegate: error: DataSource load
    failed
    org.objectstyle.cayenne.ConfigException: Can't find DataSource
    configuration file at Playground.driver.xml
            at
    org.objectstyle.cayenne.conf.DriverDataSourceFactory.load(DriverDataSourceFactory.java:196)
            at
    org.objectstyle.cayenne.conf.DriverDataSourceFactory.getDataSource(DriverDataSourceFactory.java:135)
            at
    org.objectstyle.cayenne.conf.RuntimeLoadDelegate.shouldLoadDataNode(RuntimeLoadDelegate.java:291)

    Any suggestions about how to fix this? I currently think adding something
    like
    public abstract InputStream getNodeConfig(String location);
    to Configuration, overriding in DefaultConfiguration as it does like with
    getDomain/MapConfig, and taking the directory path into account might be a
    good way. The loader delegate could then getNodeConfig from the
    Configuration that it knows.

    Holger



    This archive was generated by hypermail 2.0.0 : Mon Feb 24 2003 - 20:29:47 EST