我在Dropwizard中创建了一个小项目,在我的本地环境中运行得很好,但无法在Heroku中启动。
这是heroku日志:
2013-07-24T23:09:40+00:00 heroku[slug-compiler]: Slug compilation started
←[33m2013-07-24T23:10:54.174260+00:00 heroku[api]:←[0m Deploy 571955a by XXXXXXX
←[33m2013-07-24T23:10:54.201000+00:00 heroku[api]:←[0m Release v11 created by XXXXXXX
←[33m2013-07-24T23:10:54.240600+00:00 heroku[api]:←[0m Deploy 571955a by XXXXXXX
←[36m2013-07-24T23:10:54.334655+00:00 heroku[web.1]:←[0m State changed from crashed to starting
2013-07-24T23:10:54+00:00 heroku[slug-compiler]: Slug compilation finished
←[36m2013-07-24T23:10:59.375716+00:00 heroku[web.1]:←[0m Starting process with command `java -Xmx384m -Xss512k -XX:+UseCompressedOops -Ddw.http.port=23934 -Ddw.http.adminPort=23934 -jar target\MachineSounds-1.0-SNAPSHOT.jar server`
←[36m2013-07-24T23:10:59.952116+00:00 app[web.1]:←[0m Error: Unable to access jarfile targetMachineSounds-1.0-SNAPSHOT.jar
←[36m2013-07-24T23:11:01.529809+00:00 heroku[web.1]:←[0m Process exited with status 1
←[36m2013-07-24T23:11:01.541446+00:00 heroku[web.1]:←[0m State changed from starting to crashed
←[36m2013-07-24T23:18:31.048671+00:00 heroku[web.1]:←[0m State changed from crashed to starting
←[36m2013-07-24T23:18:35.424294+00:00 heroku[web.1]:←[0m Starting process with command `java -Xmx384m -Xss512k -XX:+UseCompressedOops -Ddw.http.port=36844 -Ddw.http.adminPort=36844 -jar target\MachineSounds-1.0-SNAPSHOT.jar server`
←[36m2013-07-24T23:18:36.453362+00:00 app[web.1]:←[0m Error: Unable to access jarfile targetMachineSounds-1.0-SNAPSHOT.jar
←[36m2013-07-24T23:18:37.811693+00:00 heroku[web.1]:←[0m Process exited with status 1
←[36m2013-07-24T23:18:37.830475+00:00 heroku[web.1]:←[0m State changed from starting to crashed
←[36m2013-07-24T23:18:45.661660+00:00 heroku[web.1]:←[0m Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
←[36m2013-07-24T23:18:45.661958+00:00 heroku[web.1]:←[0m Stopping process with SIGKILL
2013-07-24T23:22:23+00:00 heroku[slug-compiler]: Slug compilation started
←[33m2013-07-24T23:23:28.032517+00:00 heroku[api]:←[0m Deploy e37d92a by XXXXXXX
←[33m2013-07-24T23:23:28.066692+00:00 heroku[api]:←[0m Release v12 created by XXXXXXX
←[33m2013-07-24T23:23:28.105725+00:00 heroku[api]:←[0m Deploy e37d92a by XXXXXXX
←[36m2013-07-24T23:23:28.227286+00:00 heroku[web.1]:←[0m State changed from crashed to starting
2013-07-24T23:23:28+00:00 heroku[slug-compiler]: Slug compilation finished
←[36m2013-07-24T23:23:46.284459+00:00 heroku[web.1]:←[0m Starting process with command `java -Xmx384m -Xss512k -XX:+UseCompressedOops -Ddw.http.port=7581 -Ddw.http.adminPort=7581 -jar target\\MachineSounds-1.0-SNAPSHOT.jar server`
←[36m2013-07-24T23:23:47.951811+00:00 app[web.1]:←[0m Error: Unable to access jarfile target\MachineSounds-1.0-SNAPSHOT.jar
←[36m2013-07-24T23:23:50.271475+00:00 heroku[web.1]:←[0m Process exited with status 1
←[36m2013-07-24T23:23:50.290262+00:00 heroku[web.1]:←[0m State changed from starting to crashed
←[36m2013-07-24T23:23:56.613583+00:00 heroku[web.1]:←[0m Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
←[36m2013-07-24T23:23:56.613827+00:00 heroku[web.1]:←[0m Stopping process with SIGKILL
Procfile
web: java $JAVA_OPTS -Ddw.http.port=$PORT -Ddw.http.adminPort=$PORT -jar target\\MachineSounds-1.0-SNAPSHOT.jar server
聚甲醛
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ilopez</groupId>
<artifactId>MachineSounds</artifactId>
<version>1.0-SNAPSHOT</version>
<name>MachineSounds</name>
<url>http://ilopez.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.yammer.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.6.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.17.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.ilopez.machinesounds.ApiService</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:1)
jar的路径必须是target/MachineSounds-1.0-SNAPSHOT.jar
。 Heroku在linux上运行,其中/
是路径分隔符。