Re: cayenne.xml not found

From: gilbertoca (gilbertoc..mail.com)
Date: Fri Sep 04 2009 - 16:55:56 EDT

  • Next message: Andrey Razumovsky: "Re: cayenne.xml not found"

    Hi, I'm getting this exception as well.

    Andrus Adamchik wrote:
    >
    > You need to follow one of the deployment strategies for web
    > applications for this to work. E.g.:
    >
    > http://cayenne.apache.org/doc/standalone-applications.html
    >
    >
    >> DefaultConfiguration will expect cayenne.xml file to be located in the
    >> CLASSPATH. The same is true for DataMaps referenced in cayenne.xml. Their
    >> location is resolved relative to CLASSPATH as well. To make these files
    >> available to Cayenne, you can simply include them in the root of your
    >> application jar file (read Customizing Configuration on how to change
    >> that).
    >>
    >
    > Andrus
    >

    I'm using maven and my project is a traditional maven jar artifact.
    [code]
      .
       |-src
       |---main
       |-----java
       |-------park
       |---------model
       |-----------auto
       |-----------description
       |-----------mi
       |-----------ppt
       |-----------role
       |-----resources
       |-------META-INF
       |---------cayenne.xml
       |---------OracleDataDomainNode.driver.xml
       |---------ParkDataDomainMap.map.xml
       |---------PostgreSqlDataDomainNode.driver.xml
       |---test
       |-----java
       |-------park
       |---------service
       |-target
    [/code]

    I have this simple test class:
    [code]
    public class VeiculoTest {

    ..eforeClass
            public static void setUpBeforeClass() throws Exception
            {
                    ObjectContext oc = DataContext.createDataContext();
            QueryChain chain = new QueryChain();

            // Add raw SQL templates to the chain.
            chain.addQuery(new SQLTemplate(Veiculo.class, "DELETE FROM
    veiculo"));

            // Execute all of the SQL statements.
            oc.performGenericQuery(chain);
            }
    ..est
            public void testFind() {
            }
    }
    [/code]

    And the exception:

    [code]
    org.apache.cayenne.ConfigurationException: [v.3.0M6 May 25 2009 19:26:54]
    Error during Configuration initialization. [v.3.0M6 May 25 2009 19:26:54]
    [org.apache.cayenne.conf.DefaultConfiguration] : Domain configuration file
    "cayenne.xml" is not found.
            at
    org.apache.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:168)
            at
    org.apache.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:141)
            at
    org.apache.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:121)
            at
    org.apache.cayenne.conf.Configuration.getSharedConfiguration(Configuration.java:91)
            at
    org.apache.cayenne.access.DataContext.createDataContext(DataContext.java:145)
            at park.service.VeiculoTest.setUpBeforeClass(VeiculoTest.java:18)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at
    org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
            at
    org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
            at
    org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
            at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
            at
    org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
            at
    org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
            at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
            at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
            at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
            at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Caused by: org.apache.cayenne.ConfigurationException: [v.3.0M6 May 25 2009
    19:26:54] [org.apache.cayenne.conf.DefaultConfiguration] : Domain
    configuration file "cayenne.xml" is not found.
            at
    org.apache.cayenne.conf.DefaultConfiguration.initialize(DefaultConfiguration.java:141)
            at
    org.apache.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:159)
            ... 19 more

    [/code]

    And :

    [code]
    gilbert..UGEP-DMASI:~/dev/eclipse-config/workspace/park-w> ll
    target/classes/META-INF/
    total 36
    drwxr-xr-x 2 gilberto users 4096 2009-09-04 17:27 ./
    drwxr-xr-x 4 gilberto users 4096 2009-09-04 17:27 ../
    -rw-r--r-- 1 gilberto users 551 2009-09-04 17:27 cayenne.xml
    -rw-r--r-- 1 gilberto users 269 2009-09-04 17:27
    OracleDataDomainNode.driver.xml
    -rw-r--r-- 1 gilberto users 13760 2009-09-04 17:27 ParkDataDomainMap.map.xml
    -rw-r--r-- 1 gilberto users 125 2009-09-04 17:27
    PostgreSqlDataDomainNode.driver.xml
    gilbert..UGEP-DMASI:~/dev/eclipse-config/workspace/park-w>
    [/code]

    Is there any tip while working with maven projects?

    Gilberto

    -- 
    View this message in context: http://www.nabble.com/cayenne.xml-not-found-tp3599076p25301832.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.
    



    This archive was generated by hypermail 2.0.0 : Fri Sep 04 2009 - 16:56:33 EDT