Below is what I tried.
The below is my build.gradle
/*
* This build file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* user guide available at https://docs.gradle.org/3.4/userguide/java_library_plugin.html
*/
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '1.0'
repositories {
mavenLocal()
mavenCentral()
}
sourceSets {
main {
resources.srcDirs = ["src"]
java {
srcDir 'src'
}
}
}
task stage {
dependsOn build
}
stage.mustRunAfter(clean)
dependencies {
compile fileTree(dir: './webapp/WEB-INF/lib', include: ['*.jar'])
compile 'org.springframework:spring-webmvc:4.2.5.RELEASE'
compile 'org.apache.poi:poi:3.14'
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.5'
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.apache.logging.log4j:log4j-api:2.5'
compile 'org.apache.logging.log4j:log4j-core:2.5'
compile group: 'javax.validation', name: 'validation-api', version: '1.1.0.Final'
compile group: 'org.json', name: 'json', version: '20141113'
compile group: 'mysql', name:'mysql-connector-java', version:'5.1.36'
compile group: 'org.mybatis',name:'mybatis-spring',version:'1.2.3'
compile group: 'org.mybatis',name:'mybatis',version:'3.3.0'
compile group: 'org.springframework', name:'spring-orm', version:'3.1.2.RELEASE'
compile group: 'org.springframework', name:'spring-jdbc', version:'3.1.2.RELEASE'
compile group: 'org.springframework', name:'spring-webmvc', version:'3.1.2.RELEASE'
compile group: 'commons-dbcp', name:'commons-dbcp', version:'1.2.2'
compile group: 'org.activiti', name: 'activiti-engine', version: '5.18.0'
compile group: 'javax.mail', name:'mail', version:'1.4.3'
compile group: 'commons-fileupload', name:'commons-fileupload', version:'1.3.2'
compile group: 'commons-io', name:'commons-io', version:'1.3.2'
compile group: 'org.apache.axis', name:'axis', version:'1.4'
compile group: 'commons-discovery', name: 'commons-discovery', version: '0.2'
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.3'
compile group: 'javax.xml', name: 'jaxrpc-api', version: '1.1'
compile group: 'javax.xml.soap', name: 'saaj-api', version: '1.3'
compile group: 'wsdl4j', name: 'wsdl4j', version: '1.6.2'
compile group: 'org.twitter4j', name: 'twitter4j', version: '4.0.4'
compile group: 'org.twitter4j', name: 'twitter4j-stream', version: '3.0.5'
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
testCompile 'junit:junit:3.8.1'
}
Procfile
web: build/install/twitter-api9/bin/TwitterApi
When I call my apis from postman I get below errors.
Error log:
2017-04-10T19:11:21.820853+00:00 heroku[web.1]: State changed from crashed to starting
2017-04-10T19:11:26.250394+00:00 heroku[web.1]: Starting process with command `build/install/twitter-api9/bin/TwitterApi`
2017-04-10T19:11:28.283776+00:00 heroku[web.1]: Process exited with status 127
2017-04-10T19:11:28.198888+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-04-10T19:11:28.199032+00:00 app[web.1]: bash: build/install/twitter-api9/bin/TwitterApi: No such file or directory
2017-04-10T19:11:28.324886+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-10T19:11:50.592336+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/main/twitter_data" host=twitter-api9.herokuapp.com request_id=69ce91fa-9677-4b51-9190-dc40bf0f1648 fwd="49.205.228.96" dyno= connect= service= status=503 bytes= protocol=http
I think there is something wrong in procfile
as my build is successful but the only problem is just when I try to access my application/api. The application is a spring mvc application
which runs fine with war deployed in local tomcat.
EDIT:
Changed my Procfile to below where my war resides
web: sh build/libs
Now the error is:
Though the process exits with status 0 which I guess means everything is fine. But still the app crashes:
2017-04-11T14:37:32.333327+00:00 heroku[web.1]: State changed from crashed to starting
2017-04-11T14:37:37.394992+00:00 heroku[web.1]: Starting process with command sh build/libs
2017-04-11T14:37:39.356372+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-04-11T14:37:39.441553+00:00 heroku[web.1]: Process exited with status 0
2017-04-11T14:37:39.458917+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-11T15:17:01.974207+00:00 heroku[run.7895]: Awaiting client
2017-04-11T15:17:02.034572+00:00 heroku[run.7895]: Starting process with command bash
2017-04-11T15:17:02.290336+00:00 heroku[run.7895]: State changed from starting to up
2017-04-11T14:38:47.445653+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/main/twitter_data" host=twitter-api9.herokuapp.com request_id=1673e258-3fc2-4630-ac22-4869b8e68b13 fwd="49.205.228.96" dyno= connect= service= status=503 bytes= protocol=https