0

I am learning Apache Cayenne, so I am new to it.

I am following the official guide http://cayenne.apache.org/docs/3.0/tutorial.html.

I am doing exactly the same as the guide says, but when I save the project, it's generating 2 xml files, instead of 3, and when I run the java app (using the classes generated) following error appears:

Exception in thread "main" org.apache.cayenne.ConfigurationException: [v.3.0RC2 Feb 03 2010 13:38:54] Error during Configuration initialization. [v.3.0RC2 Feb 03 2010 13:38: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:143)
    at org.example.cayenne.Main.main(Main.java:21)
Caused by: org.apache.cayenne.ConfigurationException: [v.3.0RC2 Feb 03 2010 13:38: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)
    ... 5 more

I don't know what happened

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Soumitri Pattnaik
  • 3,246
  • 4
  • 24
  • 42
  • Please specify what files it generates. Also you are using pretty old version of Cayenne. I would recommend 3.1 that you can get here: http://cayenne.apache.org/download.html – andrus_a May 13 '15 at 08:28
  • I was using cayenne 3.1. I was following the above tutorial, as per the tutorial after I finish up all the steps, it should produce 3 xml files, however it was generating only 2. The Cayenne.xml file was missing. Yesterday I downloaded cayenne 3.0, just to try my luck, and it worked. So I guess the official documentation is not for the latest version of Cayenne, which is weird. – Soumitri Pattnaik May 13 '15 at 11:11

1 Answers1

1

I think I know what's going on. If you look at the exception, your stack trace indicates Cayenne version being v.3.0RC2. This is a version of the runtime. 2 files (one of which is called something like "cayenne-project.xml"), were generated by the Modeler version 3.1. You need to ensure that both the Modeler and the runtime are of the same release.

3.1 Tutorial seems to be correct in respect to the actual files in the project:

http://cayenne.apache.org/docs/3.1/tutorial/ch02.html#create-new-project

andrus_a
  • 2,528
  • 1
  • 16
  • 10