简体   繁体   English

Gradle Java Web应用程序无法在Heroku上启动

[英]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: 它启动了,但是当我将其推到远程时,heroku工具带没有显示任何错误,但是这是我从日志中得到的结果:

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 我正在使用本指南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 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: 您可以使用“ ps”命令检查正在运行的测功机:

>> 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. 上面的命令将您的应用程序设置为具有1个Web dyno。

You can refer to this page https://devcenter.heroku.com/articles/getting-started-with-java#scale-the-app for more information. 您可以参考此页面https://devcenter.heroku.com/articles/getting-started-with-java#scale-the-app了解更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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