I'm trying to migrate to Cayenne 3.1 and I had the same problem trying
to figure out this problem until I found this thread topic. I'm trying
to map the config location to a folder other than the classes folder
using the suggestion from the documentation. (BTW, could the
documentation be updated to reflect the expected location of the cayenne
configuration files?)
https://cayenne.apache.org/docs/3.1/cayenne-guide/starting-cayenne.html
"When started by the web container, it creates a instance of
ServerRuntime and stores it in the ServletContext. Note that the name of
Cayenne XML project file is derived from the "filter-name". In the
example above CayenneFilter will look for an XML file
"cayenne-project.xml". This can be overridden with
"configuration-location" init parameter."
I'm using tomcat (and I'm certainly not a power user and I don't want to
dive into DI) so I'm not clear exactly which init parameter this is
referencing. Ideally I'd like to place my cayenne configuration files
into the folder WEB-INF/DBConfig_CayenneV3.1 using the simplest possible
method so that it's clear to any future developers of my project to
understand exactly what these files are used for. I've tried adding
this to the web.xml file without success:
<servlet>
....
<init-param>
<description>Cayenne Config files</description>
<param-name>configuration-location</param-name>
<param-value>/WEB-INF/DBConfig_CayenneV3.1</param-value>
</init-param>
...
</servlet>
Thanks,
Andrew
On 02/08/2012 01:55 PM, Andrus Adamchik wrote:
Great! Yeah, removing support for WEB-INF as a config location was an
intentional step. Using CLASSPATH to locate resources is the most portable
approach that works in any Java environment, not just web apps.
And of course for those who are used to WEB-INF/, it is always easy to write
your own bootstrap code based on CayenneFilter ideas.
Andrus
On Feb 8, 2012, at 9:04 PM, jason-pa wrote:
Hi Andrus,
Thank you!
......
"cayenne-shopperDomain.xml" was located in WEB-INF. Changed my ant build
script to move "cayenne-shopperDomain.xml" (and the other associated cayenne
configuration files) to WEB-INF/classes. That was it. Doh! I did a Homer
Simpson :) I overlooked the obvious :). Thank so much for your patience.
.....
FYI
.....
Had been using Cayenne v3.0.1 and v.3.0.2 with Tomcat (on various projects).
Never to had to move the cayenne configuration files from "WEB-INF" to
"WEB-INF/classes" before. Thus, my confusion over the obvious.
......
In general, kudos to all the Cayenne contributors. I find Cayenne a joy to
work with.
......
The Cayenne Modeler v3.1M3 graphing is a great feature.
.....
Thank you so much for the help.
--
View this message in context:
http://cayenne.195.n3.nabble.com/Web-App-Configuration-with-Cayenne-v-3-1M3-tp3724256p3726896.html
Sent from the Cayenne - User mailing list archive at Nabble.com.