简体   繁体   中英

Deploying a Play 2.3.X application on Windows Azure

I recently created a small web application using Play 2.3.4. It runs fine locally so now I want to run it on Windows Azure.

So far, I've created a Java website using the Azure application gallery by following this guide http://azure.microsoft.com/en-us/documentation/articles/web-sites-java-get-started/ . The server I chose was Apache Tomcat 7. The next steps are this guide, http://azure.microsoft.com/en-us/documentation/articles/web-sites-java-add-app/ , which state that I need to place a WAR file in the webapps folder. I've followed the guide to package my Play application as a WAR file using the Play2War plugin. I then added that WAR file to d:\\home\\site\\wwwroot\\bin\\apache-tomcat-7.0.52\\webapps through FTP.

However, when I go to the website all I see is the default tomcat page.

First Question :

Did I use the Play2War plugin correctly?

I modified plugins.sbt and build.sbt

plugins.sbt

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.4")

// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.3-beta2") 

build.sbt

import com.github.play2war.plugin._

name := """playtest4"""

version := "1.0-SNAPSHOT"

Play2WarPlugin.play2WarSettings

Play2WarKeys.servletVersion := "3.0"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  javaWs
)

Afterwards, I installed sbt and ran the sbt war command. The play2war deployment page says that if I want to deploy my app as root context http://host:port/ I need to rename the WAR app as ROOT.war for Tomcat 7, but that still didn't work.

Second Question :

Is there an easier way to deploy my app on Azure?

Thanks!

Please let me know your azure website name and I can investigate. Please make sure the folder ROOT in :\\home\\site\\wwwroot\\bin\\apache-tomcat-7.0.52\\webapps is deleted before your upload your ROOT.war file. Also once you upload your ROOT.war, tomcat should automatically deploy the war file ie extract its contents into the ROOT directory. But just to be sure, restart your azure website and then hit your azure website.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM