Giter Club home page Giter Club logo

java-getting-started's Introduction

Java: Getting Started (Maven)

A barebones Java app, which can easily be deployed to Heroku.

Deploying to Heroku

Using resources for this example app counts towards your usage. Delete your app and database as soon as you are done experimenting to control costs.

By default, apps use Eco dynos if you are subscribed to Eco. Otherwise, it defaults to Basic dynos. The Eco dynos plan is shared across all Eco dynos in your account and is recommended if you plan on deploying many small apps to Heroku. Learn more about our low-cost plans here.

Eligible students can apply for platform credits through our new Heroku for GitHub Students program.

This application supports the Getting Started with Java on Heroku article - check it out for instructions on how to deploy this app to Heroku and also run it locally.

Alternatively, you can deploy it using this Heroku Button:

Deploy

For more information about using Java on Heroku, see these Dev Center articles:

java-getting-started's People

Contributors

dependabot[bot] avatar dhaulagiri avatar edmorley avatar hazendaz avatar jkutner avatar jonmountjoy avatar jonnymacs avatar malax avatar mrbradparks avatar schneems avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-getting-started's Issues

Error when trying to start locally on OSX.

Hi there,

I'm new to Heroku. Been trying to setup this tutorial and I keep getting this error when trying to start this up locally on OSX.

heroku local:start
[OKAY] Loaded ENV .env File as KEY=VALUE Format
6:16:24 PM web.1 |  Exception in thread "main" 
6:16:24 PM web.1 |  java.lang.reflect.InvocationTargetException
6:16:24 PM web.1 |  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
6:16:24 PM web.1 |  	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
6:16:24 PM web.1 |  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
6:16:24 PM web.1 |  	at java.lang.reflect.Method.invoke(Method.java:498)
6:16:24 PM web.1 |  	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
6:16:24 PM web.1 |  	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
6:16:24 PM web.1 |  	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
6:16:24 PM web.1 |  	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
6:16:24 PM web.1 |  Caused by: java.lang.IllegalAccessError: tried to access method org.springframework.core.io.support.SpringFactoriesLoader.loadFactoryNames(Ljava/lang/Class;Ljava/lang/ClassLoader;)Ljava/util/List; from class org.springframework.boot.SpringApplication
6:16:24 PM web.1 |  	at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:426)
6:16:24 PM web.1 |  	at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:418)
6:16:24 PM web.1 |  	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:266)
6:16:24 PM web.1 |  	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:247)
6:16:24 PM web.1 |  	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
6:16:24 PM web.1 |  	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
6:16:24 PM web.1 |  	at com.example.Main.main(Main.java:48)
6:16:24 PM web.1 |  	... 8 more
[DONE] Killing all processes with signal  SIGINT
6:16:24 PM web.1 Exited with exit code null

Any ideas on how to solve this problem? Works fine when submitted to Heroku.

Datasource not being recognized when running heroku local

From what I understand from the Heroku documentation, I should be able to access the database locally with no configuration updates to this project as long as I export the datasource (explained here: https://devcenter.heroku.com/articles/heroku-postgresql#local-setup), which I did.

However, I'm getting this error when trying to access localhost:5000/db.html in this project:

dataSource or dataSourceClassName or jdbcUrl is required

Is there additional configuration required to get this to work locally? It works fine once it's deployed to Heroku remotely.

Error: "FATAL: too many connections for role..."

Problem:
Hobby-dev plan for postgres has connection limit of 20. Since showDatabase() in Main.java never closes the connection, the app reaches its connection cap in 20 refreshes. So, we get "FATAL: too many connections for role..." error after 20 refreshes.

Solution:
Close the connection after displaying the info from the database. Add connection.close() after writing the database content on the screen (i.e. after line 42).

Procfile does not work on Windows

The Procfile did not work on my Windows environment. I modified the following:

  • removed the $JAVA_OPTS variable
  • replaced the colon : in the classpath with a semi-colon ;
web:    java -cp target/classes;target/dependency/* Main

This modification solved the problem on Windows but the application does not run on heroku.

Cant view the java web application after deploying

Hi,

I deployed a java web app on heroku, but I cant access through the link that heroku provides. Logs said that the mvn build was success. When open the app using the cmd command and from the dashboard, it says that

Application error

An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.

My logs are clean as I know. Followings are my logs.

2018-04-29T16:03:39.435610+00:00 app[api]: Release v1 created by user [email protected]
2018-04-29T16:03:39.435610+00:00 app[api]: Initial release by user [email protected]
2018-04-29T16:03:40.427660+00:00 app[api]: Enable Logplex by user [email protected]
2018-04-29T16:03:40.427660+00:00 app[api]: Release v2 created by user [email protected]
2018-04-29T16:04:02.000000+00:00 app[api]: Build started by user [email protected]
2018-04-29T16:09:19.839596+00:00 app[api]: Deploy bfdb621d by user [email protected]
2018-04-29T16:09:19.839596+00:00 app[api]: Release v3 created by user [email protected]
2018-04-29T16:04:02.000000+00:00 app[api]: Build succeeded
2018-04-29T16:09:52.585394+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=infinite-spire-46506.herokuapp.com request_id=313ff6e1-d1ab-4265-b540-39d10139894f fwd="112.134.44.149" dyno= connect= service= status=503 bytes= protocol=https
2018-04-29T16:09:53.914776+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=infinite-spire-46506.herokuapp.com request_id=69ae9b29-cdcb-4d53-b315-2853a44adfa3 fwd="112.134.44.149" dyno= connect= service= status=503 bytes= protocol=https
2018-04-29T16:15:42.953185+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=infinite-spire-46506.herokuapp.com request_id=0836432d-ba3d-420e-8dfd-e5397b61505f fwd="112.134.44.149" dyno= connect= service= status=503 bytes= protocol=https
2018-04-29T16:15:43.888978+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=infinite-spire-46506.herokuapp.com request_id=0308334e-1a4f-46dc-be68-4821bdbc8492 fwd="112.134.44.149" dyno= connect= service= status=503 bytes= protocol=https
2018-04-29T16:16:20.824260+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=infinite-spire-46506.herokuapp.com request_id=7e68acf5-9498-4d11-ac4e-d6338fc1bc24 fwd="112.134.44.149" dyno= connect= service= status=503 bytes= protocol=https
2018-04-29T16:16:22.301258+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=infinite-spire-46506.herokuapp.com request_id=e738e823-5867-4d61-96a7-7ccc619964e4 fwd="112.134.44.149" dyno= connect= service= status=503 bytes= protocol=https

If anyone got a solution for this issue, please add it to this thread.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.