I have problem with my Spring application built with Gradle. App includes MongoDB(MongoHQ from Heroku).
I managed how to push everything on heroku, I've added this code to my project:
@Configuration
public class MongoHQConfiguration {
public @Bean MongoDbFactory mongoDbFactory() throws MongoException, UnknownHostException {
return new SimpleMongoDbFactory(new MongoURI(System.getenv("MONGOHQ_URL")));
}
public @Bean MongoTemplate mongoTemplate() throws Exception {
return new MongoTemplate(mongoDbFactory());
}
}
After changing buildpacks to one with gradle, I pushed everything on Heroku free account with MongoHQ Sandbox.
But after trying to run my app through web browser, I'm getting this error:
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
heroku logs
gives me this output:
2014-10-15T18:19:30.293964+00:00 heroku[web.1]: Starting process with command
java -Xmx384m -Xss512k -XX:+UseCompressedOops -jar build/libs/*.jar
2014-10-15T18:19:30.797673+00:00 app[web.1]: Error: Unable to access jarfile build/libs/*.jar
2014-10-15T18:19:31.474525+00:00 heroku[web.1]: State changed from starting to crashed
2014-10-15T18:19:31.464753+00:00 heroku[web.1]: Process exited with status 1
2014-10-15T18:19:32.577398+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=tvmaniac.herokuap p.com request_id=7e8bfe6c-2669-405e-9bce-59fde09f71ef fwd="89.129.247.185" dyno= connect= service= status=503 bytes=
2014-10-15T18:19:34.016281+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=tvmani ac.herokuapp.com request_id=4300386e-dc5c-47ed-9878-0bee87128fc9 fwd="89.129.247.185" dyno= connect= service= status=503 bytes=
2014-10-15T18:19:41.988204+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=tvmaniac.herokuap p.com request_id=436db871-ea8c-428f-8cc7-160c3cb96a2d fwd="50.16.146.194" dyno= connect= service= status=503 bytes=
I think the problem is in Procfile, but I have no idea what should I add there, here's my current code:
default_process_types:
web: java $JAVA_OPTS -jar build/libs/*.jar
EDITED
Here's my build.gradle:
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-release" }
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
mainClassName = "com.shalastra.tvmaniac.TVManiacConfiguration"
jar {
baseName = 'tvmaniac'
version = '0.1.0'
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-release" }
maven { url "http://m2.neo4j.org" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
testCompile("junit:junit")
compile("org.springframework.data:spring-data-rest-webmvc")
compile("org.springframework.data:spring-data-mongodb")
compile("com.google.guava:guava:17.0")
compile("org.apache.commons:commons-lang3:3.3.2")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
task stage(dependsOn: ['clean', 'build', 'installApp'])
Thanks in advance for your help.