Skip to content

Deployment

Yann Simon edited this page May 25, 2015 · 13 revisions

You have to choose how your application has to be deployed in your servlet container:

  • in a subcontext: eg. http://host:port/myPlayApp/
  • as root context : eg. http://host:port/

Play framework 2.0.x applications must be deployed at root context. If you want to deploy in a subcontext, please use Play 2.1 or later.

Subcontext deployment

In the following examples, our Play2 application will by deployed at the following URL:

http://xxx/my-app

Subcontext = my-app

Play project configuration

As of Play2War 1.x, this configuration is now optional.

In conf/application.conf, you may add:

application.context=/my-app/

Don't forget the trailing slash, or you will get some 404 errors.

If this configuration key is manually set, it is automatically deducted from servlet context.

Deployment

Rename the generated war my-app.war before deployment.

Root context deployment

The proper way to deploy at root context is to include a configuration file into the WAR file to indicate to your application server where to deploy the application. Please refer to your application server documentation.

But you can also deploy at root context without extra configuration files.

Tomcat 7, Jetty 7/8/9

Rename the generated war ROOT.war before deployment.

JBoss 7.0.x

In standalone/configuration/standalone.xml, comment the subsystem named urn:jboss:domain:pojo:1.0.

Then follow explanations for JBoss 7.1.x below.

JBoss 7.1.x

First, disable default welcome page in standalone/configuration/standalone.xml by changing enable-welcome-root="true" to enable-welcome-root="false":

<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
  <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
  <virtual-server name="default-host" enable-welcome-root="true">
    <alias name="localhost" />
    <alias name="example.com" />
  </virtual-server>
</subsystem>

Then rename the generated war ROOT.war before deployment.

Container configurations

Jetty 9

If you have configured Play2War to build Servlet 3.0 or 3.1 compatible WAR files, you have to enable "annotations support".

Upload or deploy your WAR file

Upload or deploy your WAR file to your favorite Application Server if compatible (see Compatibility matrix above).

Next step

Read the FAQ.