-
Notifications
You must be signed in to change notification settings - Fork 71
Deployment
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.
In the following examples, our Play2 application will by deployed at the following URL:
http://xxx/my-app
Subcontext = my-app
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.
Rename the generated war my-app.war
before 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.
Rename the generated war ROOT.war
before deployment.
In standalone/configuration/standalone.xml
, comment the subsystem
named urn:jboss:domain:pojo:1.0
.
Then follow explanations for JBoss 7.1.x below.
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.
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 to your favorite Application Server if compatible (see Compatibility matrix above).
Read the FAQ.