简体   繁体   English

使用Maven将Java应用程序部署到Heroku时出错

[英]Error when deploying Java app to Heroku using maven

I have a Java web app made in Eclipse and I'm using maven. 我有一个用Eclipse开发的Java Web应用程序,并且正在使用Maven。 It works fine on localhost (Apache Tomcat). 它在localhost(Apache Tomcat)上运行良好。 When I try to deploy to Heroku using this guide I get the following error (DEBUG enabled). 当我尝试使用本指南部署到Heroku时,出现以下错误(启用调试)。 It seems very obscure because google finds next to nothing. 似乎非常晦涩,因为google几乎找不到。

[ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.1.9:deploy-war (default-cli) on project tours: Failed to deploy application: There was an exception invoking the remote service: HTTP(403): Server returned HTTP response code: 403 for URL: https://api.heroku.com/apps/tours/config-vars -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.1.9:deploy-war (default-cli) on project tours: 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:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle [错误]在项目巡视上无法执行目标com.heroku.sdk:heroku-maven-plugin:0.1.9:deploy-war(default-cli):无法部署应用程序:调用远程服务的异常:HTTP (403):服务器返回的HTTP响应代码:403用于URL: https : //api.heroku.com/apps/tours/config-vars- > [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException:无法执行目标com.heroku.sdk:heroku-maven-plugin:0.1.9:deploy-war(default-cli):在项目巡视上:无法在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor。于org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)的org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)的org.apache org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)上的.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)在org.apache.maven.lifecycle .internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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.codeh org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)上的.internal.builder.singlethreaded.SingleThreadedBuilder.java(51)在org.apache.maven.DefaultMaven.doExecute(DefaultMaven) .java:361)位于org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)位于org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)位于org.apache.maven.cli。 org.apache.maven.cli.MavenCli.main(MavenCli.java:157)的MavenCli.doMain(MavenCli.java:213)在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处在sun.reflect.NativeMethodAccessorImpl.invoke(本机方法) sun.reflect.DelegatingMethodAccessorImpl.invoke处的未知源(java.lang.reflect.Method.invoke处的未知源)(org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)在org.codeh的org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)的org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) aus.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:58) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 19 more Caused by: com.heroku.sdk.deploy.Curl$CurlException: There was an exception invoking the remote service: HTTP(403) at com.heroku.sdk.deploy.Curl.handleResponse(Curl.java:94) at com.heroku.sdk.deploy.Curl.get(Curl.java:22) at com.heroku.sdk.deploy.App.getConfigVars(App.java:139) at com.heroku.sdk.deploy.App.deploy(App.java:77) at com.heroku.sdk.deploy.App.deploy(App.java:93) at com.heroku.sdk.deploy.WarApp.deploy(WarApp.java:38) at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:54) ... 21 more Caused by: java.io.IOException: Server returned HTTP response code: 403 aus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)原因:org.apache.maven.plugin.MojoFailureException:无法在com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo。 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)的org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)的java:58)...另外19个原因创建人:com.heroku.sdk.deploy.Curl $ CurlException:调用远程服务时发生异常:com.heroku.sdk.deploy.Curl.handleResponse(Curl.java:94)处的HTTP(403) com.heroku.sdk.deploy.App.getConfigVars(App.java:139)上的.sdk.deploy.Curl.get(Curl.java:22)com.heroku.sdk.deploy.App.deploy(App.java :77),位于com.heroku.sdk.deploy(App.java:93)的com.heroku.sdk.deploy.App.deploy(App.java:93),位于com.heroku.sdk.maven的com.heroku.sdk.deploy.WarApp.deploy(WarApp.java:38)。 DeployWarMojo.execute(DeployWarMojo.java:54)...还有21个原因:java.io.IOException:服务器返回了HTTP响应代码:403 for URL: https://api.heroku.com/apps/tours/config-vars at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at com.heroku.sdk.deploy.Curl.handleResponse(Curl.java:90) ... 27 more [ERROR] [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 用于URL:位于sun.net.www.protocol.http.HttpURLConnection.getInputStream0( https://api.heroku.com/apps/tours/config-vars )位于sun.net.www.protocol.http.HttpURLConnection sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(未知源)的com.heroku.sdk.deploy.Curl.handleResponse(Curl.java:90)的.getInputStream(未知源)...另外27个[错误] [错误] [错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:[错误] [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

And here is my .pom file if that helps with anything: 这是我的.pom文件,如果有帮助的话:

<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>pl.xpam.sp</groupId>
  <artifactId>tours</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>tours Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
     <groupId>com.sun.faces</groupId>
     <artifactId>jsf-api</artifactId>
     <version>2.1.7</version>
  </dependency>
  <dependency>
     <groupId>com.sun.faces</groupId>
     <artifactId>jsf-impl</artifactId>
     <version>2.1.7</version>
  </dependency>
  <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
  </dependency>
  <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.34</version>
  </dependency>
  </dependencies>
  <build>
  <pluginManagement>
   <plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>          
        <configuration>
            <source>1.5</source>
            <target>1.5</target>
        </configuration>
    </plugin>
    <plugin>
              <groupId>com.heroku.sdk</groupId>
              <artifactId>heroku-maven-plugin</artifactId>
              <version>0.1.9</version>
              <configuration>
                <appName>tours</appName>
              </configuration>
            </plugin>
   </plugins>
  </pluginManagement>
 </build>
</project>

Set an Eclipse environment variable for HEROKU_API_KEY like in this answer (but with a different key name of course). 像此答案中那样为HEROKU_API_KEY设置Eclipse环境变量(但当然使用不同的键名)。 The value of HEROKU_API_KEY should be whatever is printed when you run heroku auth:token 在运行heroku auth:token时,HEROKU_API_KEY的值应为打印的值

The document in question has been miraculously updated with a complete description of this ;) 有关文档已奇迹般地进行了更新,并提供了完整的说明;)

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

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