You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by jason-pa <ja...@public-action.org> on 2012/02/08 19:04:27 UTC

Re: Web App Configuration with Cayenne v.3.1M3 [SOLVED]

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.

Re: Web App Configuration with Cayenne v.3.1M3 [SOLVED]

Posted by Andrew Willerding <aw...@itsurcom.com>.
Thanks for your super quick response Andrus.  I'm heavily reliant on 
Netbeans (AKA lazy programmer ;-) ) so I typically avoid delving into 
Ant configuration.  I like my IDE to take care of the details.  I just 
learned how to add a classpath to a Netbeans project to get what I want 
below!!  How sad is that?

On 07/26/2013 11:03 AM, Andrus Adamchik wrote:
>> (BTW, could the documentation be updated to reflect the expected location of the cayenne configuration files?)
> It has this little piece there: "Location is a '/'-separated path (same path separator is used on UNIX and Windows) that is resolved relative to the application classpath". But I guess we can emphasize it better.
>
>> 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.
> First, let's maybe rename it to "DBConfig_CayenneV3_1" (Just in case, as "." can mean other things in Java). Now since you are in control of the app structure, I suggest you just put them under "WEB-INF/classes/DBConfig_CayenneV3_1" or a similar folder. But this is in a resulting .war. In your *source* you would simply put it in a folder that is packaged to WEB-INF/classes during the .war assembly. And your build tool (Maven, Ant, etc) will ensure it is in the right place in archive.
>
> IMO placing it in "src/main/resources" (if you are using Maven) or to your Java sources folder will make it very clear to developers. (in a DBConfig_CayenneV3_1 subpackage if you like).
>
> Sticking to locations that end up on CLASSPATH one way or the other will ensure you don't need a custom CayenneFilter. But of course you can write one to load from WEB-INF too, which requires some, but very minimal DI understanding.
>
> Andrus
>
> On Jul 26, 2013, at 5:45 PM, Andrew Willerding <aw...@itsurcom.com> wrote:
>> 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.
>>>>
>>


Re: Web App Configuration with Cayenne v.3.1M3 [SOLVED]

Posted by Andrus Adamchik <an...@objectstyle.org>.
> (BTW, could the documentation be updated to reflect the expected location of the cayenne configuration files?)

It has this little piece there: "Location is a '/'-separated path (same path separator is used on UNIX and Windows) that is resolved relative to the application classpath". But I guess we can emphasize it better.

> 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. 

First, let's maybe rename it to "DBConfig_CayenneV3_1" (Just in case, as "." can mean other things in Java). Now since you are in control of the app structure, I suggest you just put them under "WEB-INF/classes/DBConfig_CayenneV3_1" or a similar folder. But this is in a resulting .war. In your *source* you would simply put it in a folder that is packaged to WEB-INF/classes during the .war assembly. And your build tool (Maven, Ant, etc) will ensure it is in the right place in archive.

IMO placing it in "src/main/resources" (if you are using Maven) or to your Java sources folder will make it very clear to developers. (in a DBConfig_CayenneV3_1 subpackage if you like). 

Sticking to locations that end up on CLASSPATH one way or the other will ensure you don't need a custom CayenneFilter. But of course you can write one to load from WEB-INF too, which requires some, but very minimal DI understanding.

Andrus

On Jul 26, 2013, at 5:45 PM, Andrew Willerding <aw...@itsurcom.com> wrote:
> 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.
>>> 
> 
> 


Re: Web App Configuration with Cayenne v.3.1M3 [SOLVED]

Posted by Andrew Willerding <aw...@itsurcom.com>.
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.
>>


Re: Web App Configuration with Cayenne v.3.1M3 [SOLVED]

Posted by Andrus Adamchik <an...@objectstyle.org>.
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.
>