setting play id for tomcat or websphere

151 views
Skip to first unread message

jr dev

unread,
Jun 20, 2011, 8:39:11 AM6/20/11
to play-framework
Hi,

When deploying a play application to application container such as
tomcat or websphere how do i set the play id? Is there is system
variable that needs to be specified?

Matt Wolff

unread,
Jun 20, 2011, 1:14:47 PM6/20/11
to play-framework
You set the play id when you are creating the WAR file. Example :
play war myProject --%dev -o /mydir/myProject --zip

I believe that "test" is a special case. You'll have to look through
older posts for more info.

jr dev

unread,
Jun 20, 2011, 11:22:24 PM6/20/11
to play-framework
Hi,

The problem is that i would need to build multiple war projects for
each environment. In the company i work for a single war file must be
able to be used in multiple environments.

Is it possible to set the play id at runtime?

In spring we would do something like this and the runEnv value would
be set in the JVM. Is it possible to do something like this
with the application.conf file.

<bean id="ldapEtrustPropertyConfiguration"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:ldap/etrust.properties</value>
<value>classpath:ldap/etrust-${runEnv}.properties</
value>
</list>
</property>
</bean>


On Jun 21, 3:14 am, Matt Wolff <wolffmls...@gmail.com> wrote:
> You set theplayidwhen you are creating the WAR file.  Example :playwar myProject --%dev -o /mydir/myProject --zip
>
> I believe that "test" is a special case.  You'll have to look through
> older posts for more info.
>
> On Jun 20, 7:39 am, jr dev <share.readin...@gmail.com> wrote:
>
> > Hi,
>
> > When deploying aplayapplication to application container such as
> > tomcat or websphere how do i set theplayid? Is there is system

paul

unread,
Jul 5, 2011, 2:41:24 AM7/5/11
to play-fr...@googlegroups.com
I can see the benefits of supporting multiple environments with a single build, especially in an enterprise environment which is quite rigid. Multiple environments meaning that the "play.id" is different in every environment.

We've got similar issues where only ONE .war is progressed from one environment to then next, then finally to production.
Building a separate .war for every environment is not really an option for us.
We have many integration environment (~7 SIT environments), each having a different configuration (i.e DB connection, file paths, etc).

Is there a way to dynamically read the "play.id" and have it load up based on some system environment variable?

Thanks

paul

unread,
Jul 5, 2011, 2:46:31 AM7/5/11
to play-fr...@googlegroups.com
Been looking at the ServletWrapper class and it seems to be loading the play.id from the web.xml.

final String playId = e.getServletContext().getInitParameter("play.id");

Unfortunately there is no "nice" way of overriding this behavior except for copying the whole class and have my own implementation.

Would be nice if:
e.getServletContext().getInitParameter("play.id");

can be overridden with a custom behavior.

I can probably whip something up, but how do we get this into the framework?

Andreas Bjärlestam

unread,
Mar 8, 2012, 7:27:51 AM3/8/12
to play-fr...@googlegroups.com
Anyone solved this issue? I need to have the same war-file read different configurations.

paul

unread,
Mar 9, 2012, 7:58:34 AM3/9/12
to play-fr...@googlegroups.com
Yes, we solved it by using the @include files configured in application.conf. So let's say you have a system property "run_environment" which can either be dev, test1,test2, production.
Then in the application.conf (first line) - @include.application_settings=appSettings-{run_environment}.properties

Bundle all the different configuration files at the same level as application.conf.

Basically all your properties will be read from the environment specific properties file before the application.conf file. Now you have a single war file which supports multiple environment depending on your system variable.

Reply all
Reply to author
Forward
0 new messages