0

I have a Java web app made in Eclipse and I'm using maven. It works fine on localhost (Apache Tomcat). When I try to deploy to Heroku using this guide I get the following error (DEBUG enabled). It seems very obscure because google finds next to nothing.

[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.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.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: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 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

And here is my .pom file if that helps with anything:

<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>
cen
  • 2,873
  • 3
  • 31
  • 56
  • The HTTP 403 suggests there is a problem with authorization against the Heroku services, which can mean that either the auth token isn't right or there is a mismatch between the token and what app you are trying to deploy. Double check that the `appName` is actually set to the name of the corresponding Heroku app. – bimsapi Dec 10 '14 at 17:20
  • Hmm yes, that must be it, I have no authorization. When I use heroku from CLI it is already authorized with certs but when used from inside eclipse it appears not to be so. How do I invoke the authentication from eclipse? – cen Dec 10 '14 at 23:04
  • 1
    Try setting an Eclipse environment variable for HEROKU_API_KEY [like in this answer](http://stackoverflow.com/a/12810433/63308) (but with a different key name of course). The value of HEROKU_API_KEY should be whatever is printed when you run `heroku auth:token` – codefinger Dec 11 '14 at 01:20
  • @joekutner's response should be the accepted answer. – bimsapi Dec 11 '14 at 14:57

1 Answers1

0

Set an Eclipse environment variable for HEROKU_API_KEY like in this answer (but with a different key name of course). The value of HEROKU_API_KEY should be whatever is printed when you run heroku auth:token

The document in question has been miraculously updated with a complete description of this ;)

Community
  • 1
  • 1
codefinger
  • 10,088
  • 7
  • 39
  • 51
  • I wish this worked but it didn't. Exactly the same error is thrown. – cen Dec 12 '14 at 16:43
  • Does the account you used to get `heroku auth:token` have access to the "tours" app? – codefinger Dec 13 '14 at 17:05
  • I managed to deploy using a different tutorial with webapp-runner. So yeah, pretty sure it has access. – cen Dec 14 '14 at 18:33
  • Does the `mvn heroku:deploy` task work from the command line? Or do you get the same 403? – codefinger Dec 15 '14 at 18:59
  • How can I use mvn from cmd? – cen Dec 17 '14 at 16:30
  • [Open a command prompt](http://windows.microsoft.com/en-US/windows-vista/Open-a-Command-Prompt-window) and then move to the root directory of your application by using the `cd` command. Then run `heroku auth:token` to ensure that the Heroku toolbelt is installed. And then run `mvn heroku:deploy` from that directory. You will also need to [install Maven so that it is on your PATH](http://www.mkyong.com/maven/how-to-install-maven-in-windows/). – codefinger Dec 18 '14 at 19:31