简体   繁体   English

Java Web应用程序在部署到Heroku时导致构建失败

[英]Java Web app gives build failure while deploying to Heroku

I've created a simple Web app from jersey archetype in Eclipse and followed the tutorial given here , but the command mvn -e heroku:deploy-war throws the following errors 我已经从Eclipse中的jersey archetype创建了一个简单的Web应用程序,并按照此处给出的教程进行操作,但是命令mvn -e heroku:deploy-war引发以下错误

$ mvn -e heroku:deploy-war
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building wallpost 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> heroku-maven-plugin:1.1.1:deploy-war (default-cli) > package @ wallpost >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ wallpost ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ wallpost ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ wallpost ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Workspace For Java\wallpost\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ wallpost ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ wallpost ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ wallpost ---
[INFO] Packaging webapp
[INFO] Assembling webapp [wallpost] in [D:\Workspace For Java\wallpost\target\wallpost]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Workspace For Java\wallpost\src\main\webapp]
[INFO] Webapp assembled in [187 msecs]
[INFO] Building war: D:\Workspace For Java\wallpost\target\wallpost.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- maven-dependency-plugin:2.3:copy-dependencies (copy-dependencies) @ wallpost ---
[INFO] hk2-api-2.5.0-b05.jar already exists in destination.
[INFO] jersey-guava-2.23.2.jar already exists in destination.
[INFO] hk2-utils-2.5.0-b05.jar already exists in destination.
[INFO] javassist-3.20.0-GA.jar already exists in destination.
[INFO] osgi-resource-locator-1.0.1.jar already exists in destination.
[INFO] jersey-server-2.23.2.jar already exists in destination.
[INFO] jersey-client-2.23.2.jar already exists in destination.
[INFO] javax.ws.rs-api-2.0.1.jar already exists in destination.
[INFO] hk2-locator-2.5.0-b05.jar already exists in destination.
[INFO] jersey-container-servlet-core-2.23.2.jar already exists in destination.
[INFO] jersey-common-2.23.2.jar already exists in destination.
[INFO] validation-api-1.1.0.Final.jar already exists in destination.
[INFO] aopalliance-repackaged-2.5.0-b05.jar already exists in destination.
[INFO] jersey-media-jaxb-2.23.2.jar already exists in destination.
[INFO] javax.inject-2.5.0-b05.jar already exists in destination.
[INFO] javax.annotation-api-1.2.jar already exists in destination.
[INFO]
[INFO] --- maven-dependency-plugin:2.3:copy (default) @ wallpost ---
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:8.0.30.2:jar
[INFO] com.github.jsimone:webapp-runner:8.0.30.2:jar already exists in D:\Workspace For Java\wallpost\target\dependency
[INFO]
[INFO] <<< heroku-maven-plugin:1.1.1:deploy-war (default-cli) < package @ wallpost <<<
[INFO]
[INFO] --- heroku-maven-plugin:1.1.1:deploy-war (default-cli) @ wallpost ---
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:8.0.30.2:jar
[INFO] com.github.jsimone:webapp-runner:8.0.30.2:jar already exists in D:\Workspace For Java\wallpost\target\dependency
[INFO] -----> Packaging application...
[INFO]        - app: immense-beach-86309t
[INFO]        - including: target/dependency/webapp-runner.jar
[INFO]        - including: target/wallpost.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.865 s
[INFO] Finished at: 2016-10-17T02:43:01+05:30
[INFO] Final Memory: 26M/225M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:1.1.1:deploy-war (default-cli) on project wallpost: Failed to deploy application: Not Found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.heroku.sdk:heroku-maven-plugin:1.1.1:deploy-war (default-cli) on project wallpost: Failed to deploy application
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to deploy application
        at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:26)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: org.apache.http.client.HttpResponseException: Not Found
        at com.heroku.sdk.deploy.utils.RestClient.handleResponse(RestClient.java:172)
        at com.heroku.sdk.deploy.utils.RestClient.get(RestClient.java:66)
        at com.heroku.sdk.deploy.ConfigVars.getConfigVars(ConfigVars.java:41)
        at com.heroku.sdk.deploy.ConfigVars.merge(ConfigVars.java:24)
        at com.heroku.sdk.deploy.Deployer.mergeConfigVars(Deployer.java:106)
        at com.heroku.sdk.deploy.Deployer.deploy(Deployer.java:68)
        at com.heroku.sdk.deploy.App.deploy(App.java:57)
        at com.heroku.sdk.deploy.App.deploy(App.java:61)
        at com.heroku.sdk.deploy.WarApp.deploy(WarApp.java:30)
        at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:22)
        ... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I have also tried the suggestions mentioned here , here , here and here , but they were of no use. 我也尝试过这里这里这里这里提到的建议,但是它们没有用。 I made sure the app name on Heroku matched the <appName></appName> in pom.xml , but that too didn't solve the problem. 我确保Heroku上的应用程序名称与pom.xml<appName></appName>匹配,但这也不能解决问题。

Following is my pom.xml 以下是我的pom.xml

<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.auro.assignment</groupId>
    <artifactId>wallpost</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>wallpost</name>

    <build>
        <finalName>wallpost</finalName>
        <plugins>

        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals><goal>copy-dependencies</goal></goals>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals><goal>copy</goal></goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.github.jsimone</groupId>
                                    <artifactId>webapp-runner</artifactId>
                                    <version>8.0.30.2</version>
                                    <destFileName>webapp-runner.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>   
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <inherited>true</inherited>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <configuration>
                    <jdkVersion>1.8</jdkVersion>
                    <appName>immense-beach-86309t</appName>
                </configuration>
                <groupId>com.heroku.sdk</groupId>
                <artifactId>heroku-maven-plugin</artifactId>
                <version>1.1.1</version>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>${jersey.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet-core</artifactId>
            <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
            <!-- artifactId>jersey-container-servlet</artifactId -->
        </dependency>
        <!-- uncomment this to get JSON support
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-moxy</artifactId>
        </dependency>
        -->
    </dependencies>
    <properties>
        <jersey.version>2.23.2</jersey.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

Below is the Procfile 下面是Procfile

web:    java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

I suspect that your app name is supposed to be "immense-beach-86309" but you have "immense-beach-86309t" (note the trailing "t") in your pom.xml entry for <appName> . 我怀疑您的应用程序名称应为“ immense-beach-86309”,但您的<appName> pom.xml条目中具有“ immense-beach-86309t”(请注意尾部的“ t”)。

The error message should be better, and I've opened an issue on the heroku-maven-plugin project , which is open source. 错误消息应该更好,并且我已经开源的heroku-maven-plugin项目上打开了一个问题

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

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