title: Error 501 on Heroku
body: <p>I have craeted a Web Application that can be deployed on Heroku by maven eclipse.</p>
  
  <p><strong>Group Id:</strong> org.glassfish.jersey.archetypes</p>
  
  <p><strong>Artifact Id:</strong> jersey-heroku-webapp</p>
  
  <p><strong>version:</strong> 2.17</p>
  
  <p>then I followed this guide(1.5) to push it to Heroku.</p>
  
  <p><a href="https://jersey.java.net/documentation/latest/getting-started.html#heroku-webapp" rel="nofollow">https://jersey.java.net/documentation/latest/getting-started.html#heroku-webapp</a></p>
  
  <p>I can not access my <code>apple</code>  class from the http link-  like this:</p>
  
  <p><a href="https://salty-refuge-2027.herokuapp.com/apple" rel="nofollow">https://salty-refuge-2027.herokuapp.com/apple</a></p>
  
  <p>and I am getting the error <code>500</code></p>
  
  <p>I have tested it before without the JDBC procedure and I got the output <code>Hello, from apple class</code> therefore I guess it depends on the my implementation for the <code>Heroku Postgres</code>
  <a href="https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-java" rel="nofollow">https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-java</a> </p>
  
  <pre><code>    import java.net.URI;
      import java.net.URISyntaxException;
      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.SQLException;
  
      import javax.ws.rs.GET;
      import javax.ws.rs.Path;
      import javax.ws.rs.Produces;
      import javax.ws.rs.core.MediaType;
  
      @Path("apple")
      public class Apple {
  
              @GET
              @Produces(MediaType.TEXT_PLAIN)
              public String getIt() {
                  try {
                      getConnection();
                  } catch (URISyntaxException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  } catch (SQLException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
  
                  return "Hello, from apple class";
              }
  
              private static Connection getConnection() throws URISyntaxException, SQLException {
          //I have modified my orginal ingredients.
                  URI dbUri = new URI(System.getenv("postgres://mglfe545z6ixsgk:yf8gyK1hBh3jknzqepLnajWRLv@
  ec2-60-16-433-222.compute-1.amazonaws.com:5432/d5kal1r7jtavr9"));
  
                  String username = dbUri.getUserInfo().split(":")[0];
                  String password = dbUri.getUserInfo().split(":")[1];
                  String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':'
                          + dbUri.getPort() + dbUri.getPath();
  
                  Connection con = DriverManager.getConnection(dbUrl, username, password);
                  System.out.println("It works");
                  return con;
              }
          }
  </code></pre>
  
  <p>I appreciate any help.</p>