RE: Runtime Error: how to find cayenne.xml

From: Dave Paules (dn..uantumleap.us)
Date: Thu Mar 06 2003 - 12:19:26 EST

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

    I'm sorry Holger... :(
    Even with your new classes, the situation hasn't changed. When not in a jar,
    the packaged config files are found and processed correctly. Once the
    packaged *.xml files are put in a jar, it doesn't work. Interestingly,
    you've reached the point that I reached a few days ago. :) (Although I
    admit, I never tested jarring things with my subclass of
    DefaultConfiguration, so I am putting your code through much more rigorous
    testing).

    The cayenne file is found, but after the file is parsed, the
    RuntimeLoadDelegate called finishedLoading() to check for any errors that
    might have occured during the parse.

    I don't know what those errors were, but there was more than one. In MY
    subclass, I set the protected variable ignoringLoadFailures = true;

    While this hack allowed the files to be loaded, the minute I tried to add an
    object to the database, I ran into problems because it couldn't resolve the
    createAndRegister("SomeObject"); method to the appropriate class. Not
    surprising given I was ignoring any errors on parsing the files.

    Here's the actual error I received when running with your new classes and my
    *.xml files in a package within the jar.

    ERROR Configuration: Error initializing shared Configuration
    org.objectstyle.cayenne.ConfigException:
    [database.cayenne_config.PackageConfiguration] : Failed to load domain
    and/or its maps/nodes.
            at
    org.objectstyle.cayenne.conf.RuntimeLoadDelegate.finishedLoading(RuntimeLoad
    Delegate.java:419)
            at
    org.objectstyle.cayenne.conf.ConfigLoader.loadDomains(ConfigLoader.java:118)
            at
    org.objectstyle.cayenne.conf.Configuration.init(Configuration.java:260)
            at
    org.objectstyle.cayenne.conf.Configuration.initSharedConfig(Configuration.ja
    va:214)
            at database.DBTests.MultiUserTest.loadCayenne(MultiUserTest.java:64)
            at database.DBTests.MultiUserTest.<init>(MultiUserTest.java:25)
            at database.DBTests.MultiUserTest.main(MultiUserTest.java:29)
    Exception in thread "main" java.lang.RuntimeException: Error initializing
    shared Configuration
            at
    org.objectstyle.cayenne.conf.Configuration.initSharedConfig(Configuration.ja
    va:217)
            at database.DBTests.MultiUserTest.loadCayenne(MultiUserTest.java:64)
            at database.DBTests.MultiUserTest.<init>(MultiUserTest.java:25)
            at database.DBTests.MultiUserTest.main(MultiUserTest.java:29)

    Thanks
    Dave Paules
    Quantum Leap Innovations

    -----Original Message-----
    From: Holger Hoffstatte [mailto:holge..izards.de]
    Sent: Thursday, March 06, 2003 5:48 AM
    To: 'cayenne-user'
    Subject: Re: Runtime Error: how to find cayenne.xml

    Dave Paules wrote:
    > Hi Holger!
    > You've solved the problem when the *.xml and PackageConfiguration files
    are
    > not in a jar. :) Great work.
    >
    > However, once I put the entire database/ folder (and all its nested
    classes
    > and files) in a jar, I got right back to the error:
    > Domain configuration file "cayenne.xml" is not found.

    Take this, you evil bug reporter! :)
    Introducing the idea of a resource path by using File.separator was a good
    idea gone wrong, since it needs to be '/' for JAR file loading. duh!

    Holger



    This archive was generated by hypermail 2.0.0 : Thu Mar 06 2003 - 12:26:36 EST