cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gilbertoca <gilbert...@gmail.com>
Subject Re: cayenne.xml not found
Date Wed, 09 Sep 2009 13:11:20 GMT

Thanks, it's working now!

>From here[1], the question "How do I use Cayenne with Maven2?" says how to
use cayenne maven plugins and not how to setup cayenne with maven. 
I know there is a description here [2], but very simple! I have to search on
mail list and ask a question to make it work.

Regards,

Gilberto


[1]http://cwiki.apache.org/CAY/cayenne-faq.html
[2]http://cayenne.apache.org/download.html


Andrey Razumovsky wrote:
> 
> As written in docs, cayenne.xml and other xml files must be located in the
> root of your classpath, i.e. in src/main/resources, not in META-INF
> 
> 2009/9/5 gilbertoca <gilbertoca@gmail.com>
> 
>>
>> 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 {
>>
>>        @BeforeClass
>>        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);
>>        }
>>        @Test
>>        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]
>> gilberto@SUGEP-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
>> gilberto@SUGEP-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.
>>
>>
> 
> 
> -- 
> Andrey
> 
> 

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


Mime
View raw message