简体   繁体   中英

Gradle java web app doesn't start on heroku

When I deploy my app locally with

heroku local

It starts up, but when I'm pushing it to remote, heroku toolbelt doesn't show any error, but here is what I get from logs:

2016-05-15T16:00:13.504799+00:00 heroku[slug-compiler]: Slug  compilation started
2016-05-15T16:00:13.504808+00:00 heroku[slug-compiler]: Slug compilation finished
2016-05-15T16:00:19.131289+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=damp-ocean-4271.herokuapp.com request_id=d0d12240-3923-467f-bf21-84bb5bcd79ca fwd="46.53.183.156" dyno= connect= service= status=503 bytes=

I was using this guide https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku

Procfile

web: cd build ; java -jar ../build/server/webapp-runner-*.jar --expand-war --port $PORT libs/*.war

build.gradle

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'maven'

group = 'com.ily'
version = '1.1-SNAPSHOT'

description = """web"""

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
  mavenLocal()
  maven { url "http://repo1.maven.org/maven2" }
  maven { url "http://repository.jboss.org/nexus/content/groups/public/" }
}
dependencies {
  compile group: 'org.mybatis', name: 'mybatis', version:'3.3.0'
  compile group: 'org.mybatis', name: 'mybatis-spring', version:'1.2.3'
  compile group: 'org.springframework', name: 'spring-jdbc',  version:'4.2.2.RELEASE'
  compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
  compile group: 'javax.servlet', name: 'jstl', version:'1.2'
  compile group: 'com.mashape.unirest', name: 'unirest-java', version:'1.4.5'
  compile group: 'org.postgresql', name: 'postgresql', version:'9.4-1201-jdbc4'
  compile group: 'org.springframework', name: 'spring-core', version:'4.2.2.RELEASE'
  compile group: 'org.springframework', name: 'spring-test', version:'4.2.2.RELEASE'
  compile group: 'org.springframework', name: 'spring-web', version:'4.2.2.RELEASE'
  compile group: 'org.springframework', name: 'spring-webmvc', version:'4.2.2.RELEASE'
  compile group: 'org.bitbucket.b_c', name: 'jose4j', version:'0.4.4'
  compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version:'2.6.2'
  compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.7'
  compile group: 'org.slf4j', name: 'slf4j-log4j12', version:'1.7.7'
  compile group: 'org.slf4j', name: 'jcl-over-slf4j', version:'1.7.7'
  compile group: 'log4j', name: 'log4j', version:'1.2.17'
  compile group: 'org.eclipse.jetty', name: 'jetty-servlet',    version:'9.2.10.v20150310'
  compile 'com.github.jsimone:webapp-runner:8.0.30.2'
  testCompile group: 'org.testng', name: 'testng', version:'6.9.6'
}

task stage() {
  dependsOn clean, war
}
tasks.stage.doLast() {
  delete fileTree(dir: "build/distributions")
  delete fileTree(dir: "build/assetCompile")
  delete fileTree(dir: "build/distributions")
  delete fileTree(dir: "build/libs", exclude: "*.war")
}
war.mustRunAfter clean

task copyToLib(type: Copy) {
  into "$buildDir/server"
  from(configurations.compile) {
    include "webapp-runner*"
  }
}

stage.dependsOn(copyToLib)

I think it's possible that you have not turned on any web dynos. You can check how many dynos are running using the 'ps' command:

>> heroku ps

You can then scale your application's web dynos like this:

>> heroku ps:scale web=1

The above command would set your application to have 1 web dyno.

You can refer to this page https://devcenter.heroku.com/articles/getting-started-with-java#scale-the-app for more information.

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