You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by em...@mengozzi.com on 2010/09/15 00:51:20 UTC
Deploying multiple instances from a single war
I have a Swing ROP application, and i had to create another database,
which is equal to the one im using, and i wasen't able to figureout
another way to address the other database, cept copying/renaming the
webapplication war, and changing the Node.driver.xml.
So far now i got WebApp1.war - > http://..:8080/WebApp1/, WebApp2.war ->
http://..:8080/WebApp2/.
Is there a way to specify in the tomcat Context.xml, which dataDomain to use?
Thanks in advice,
Emanuele.
Re: Deploying multiple instances from a single war
Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Emanuele,
The trick would be to create a custom subclass of Cayenne HessianService, overriding 'initCayenneStack(Map properties)'. Based on some property value in a properties map, you can load Cayenne stack from an alternative location (e.g. by renaming one of the cayenne.xml files, and passing it as a parameter to DefaultConfiguration).
After that map 2 HessianServlets in web.xml using different URLs, passing each a custom "service-class" parameter, as well as the custom Cayenne stack name parameter.
This way the same webapp will serve 2 separate Cayenne stacks at different URLs.
HTH,
Andrus
The properties map passed to this service is taken from servlet init parameters in web.xml. So
On Sep 14, 2010, at 6:51 PM, emanuele@mengozzi.com wrote:
> I have a Swing ROP application, and i had to create another database,
> which is equal to the one im using, and i wasen't able to figureout
> another way to address the other database, cept copying/renaming the
> webapplication war, and changing the Node.driver.xml.
>
> So far now i got WebApp1.war - > http://..:8080/WebApp1/, WebApp2.war ->
> http://..:8080/WebApp2/.
>
> Is there a way to specify in the tomcat Context.xml, which dataDomain to use?
>
> Thanks in advice,
>
> Emanuele.
>
>
>
>