I am struggling with this issue for a couple of days and couldn't find anything on SO and the description of error codes on heroku is to vague for me to figure out anything.I have created a basic app with no db integration, with spring framework , thymeleaf and spring mail.I have no spring security.After successfully deploying it to heroku i try to start the application server and this is what i get in the heroku logs.The app works fine on localhost with no issue.
2020-08-05T08:03:50.144941+00:00 app[web.1]: 2020-08-05 08:03:50.144 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-08-05T08:03:50.458342+00:00 app[web.1]: 2020-08-05 08:03:50.458 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-08-05T08:03:50.471638+00:00 app[web.1]: 2020-08-05 08:03:50.471 INFO 4 --- [ main] c.e.P.MyWebWebsiteApplication : Started MyWebWebsiteApplication in 2.688 seconds (JVM running for 3.226)
2020-08-05T08:04:53.993643+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=myweb01.herokuapp.com request_id=0fb69db1-5c01-412e-b01f-451a8a2b7ad8 fwd="86.124.21.129" dyno= connect= service= status=503 bytes= protocol=https
2020-08-05T08:05:16.255402+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2020-08-05T08:05:16.271979+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-08-05T08:05:16.349020+00:00 heroku[web.1]: Process exited with status 137
2020-08-05T08:05:16.389343+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-05T08:05:16.392175+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-05T08:05:23.662195+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/MyWebWebsite-0.0.1-SNAPSHOT.jar -Dserver.port=25487 $JAR_OPTS`
2020-08-05T08:05:25.791836+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2020-08-05T08:05:25.796964+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
This is my procfile:
web: java $JAVA_OPTS -jar target/MyWebWebsite-0.0.1-SNAPSHOT.jar -Dserver.port=$PORT $JAR_OPTS
reading the logs and finding this here Tomcat started on port(s): 8080 i suppose could be an issue? i mean tomcat is trying to start on localhost port instead of heroku port?If this is the case how can i fix it? if this is not the case , what could be the issue ?
From the docs here error code H20 means
The router will enqueue requests for 75 seconds while waiting for
starting processes to reach an “up” state. If after 75 seconds, no web
dynos have reached an “up” state, the router logs H20 and serves a
standard error page
If your application requires more time to boot, you may use the boot timeout tool to increase the limit. However, in general, slow boot times will make it harder to deploy your application and will make recovery from dyno failures slower, so this should be considered a temporary solution
Try to set boot timeout to 120 seconds - some SpringBoot apps take some time to boot. The request can be done as shown here: https://devcenter.heroku.com/changelog-items/364
Also, the health check process is based on HTTP requests, so be sure that your app is served through normal Web ports (80, 8080, 443).
Related
I'm trying to create a similar application like the one mentioned here https://github.com/heroku/devcenter-java-quartz-rabbitmq suggested on Heroku by this article https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes-java-quartz-rabbitmq.
The only difference is that at the moment I have a web app doing nothing ("Hello World") and a scheduler app printing the current time.
Unfortunately, after 30 min that I'm not using the application, both web and scheduler stop working:
2020-02-09T15:20:17.911457+00:00 app[scheduler.1]: 15:20:17.911 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskExecutor - Shutting down ExecutorService 'applicationTaskExecutor'
2020-02-09T15:20:18.151399+00:00 app[web.1]: 15:20:18.151 [SpringContextShutdownHook] INFO org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED paused.
2020-02-09T15:20:18.151689+00:00 app[web.1]: 15:20:18.151 [SpringContextShutdownHook] INFO o.s.s.quartz.SchedulerFactoryBean - Shutting down Quartz Scheduler
2020-02-09T15:20:18.151775+00:00 app[web.1]: 15:20:18.151 [SpringContextShutdownHook] INFO org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED shutting down.
2020-02-09T15:20:18.151840+00:00 app[web.1]: 15:20:18.151 [SpringContextShutdownHook] INFO org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED paused.
2020-02-09T15:20:18.152244+00:00 app[web.1]: 15:20:18.152 [SpringContextShutdownHook] INFO org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED shutdown complete.
2020-02-09T15:20:18.152871+00:00 app[web.1]: 15:20:18.152 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskExecutor - Shutting down ExecutorService 'applicationTaskExecutor'
2020-02-09T15:20:18.135436+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-02-09T15:20:18.247822+00:00 heroku[web.1]: Process exited with status 143
2020-02-09T15:20:18.123889+00:00 heroku[scheduler.1]: Process exited with status 143
The Procfile is pretty simple:
web: java $JAVA_OPTS -Dserver.port=$PORT -jar target/*.jar
scheduler: java $JAVA_OPTS -cp target/*.jar -Dloader.main=algotrading.app.scheduler.SchedulerApp org.springframework.boot.loader.PropertiesLauncher
Is there something I am missing in the example?
Regards
R
I opened a ticket as suggested by #codefinger and I received immediate support. The answer to my question is that when you are using a web dyno with free dynos, when it becomes idle (due to dyno sleeping) all other dynos will become idle too.
This is the expected behaviour.
They will update the documentation as soos as they can.
I want to run my java web app - simple REST API based on JAX-RS at Heroku. Every time build was processed successfully but after hiting correct URL app does not return expected result.
I call URL - https://mandayscz.herokuapp.com/api/month/?month=6&year=2019&hours=8 - this structure worked at localhost. Of course root is different before first slash at localhost.
On the other hand - at localhost it works fine. So it must be something wrong in code or in Heroku env.
GIT of that service is here - https://github.com/pavelpetrcz/MandaysFigu
In Heroku CLI I got log with Status 0. But I could not find what does it mean in my case.
Log from CLI:
2019-09-09T21:54:15.000000+00:00 app[api]: Build started by user pavelpetr.cz#gmail.com
2019-09-09T21:54:43.156953+00:00 app[api]: Release v28 created by user pavelpetr.cz#gmail.com
2019-09-09T21:54:43.156953+00:00 app[api]: Deploy 1de65d1e by user pavelpetr.cz#gmail.com
2019-09-09T21:54:44.396594+00:00 heroku[web.1]: State changed from crashed to starting
2019-09-09T21:54:48.438387+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -cp target/classes:target/dependency/* Main`
2019-09-09T21:54:48.000000+00:00 app[api]: Build succeeded
2019-09-09T21:54:50.249092+00:00 heroku[web.1]: State changed from starting to crashed
2019-09-09T21:54:50.133290+00:00 heroku[web.1]: Process exited with status 0
2019-09-09T21:54:49.994313+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-09-09T21:54:49.997583+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2019-09-09T21:58:29.232849+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/api/month/?month=6&year=2019&hours=8" host=mandayscz.herokuapp.com request_id=3d65ffb9-65ca-4e00-bdab-c5ed8459d2a0 fwd="89.102.10.194" dyno= connect= service= status=503 bytes= protocol=https
I use java 8, Tomcat, Jersey as implementation for JAX-RS and few more dependencies.
I tried to play around with Procfile. Unsuccessfully.
I want to start my app and be able to get data from database underneath.
Anybody with idea what could I do to start my app?
Your application create war file, so you need to adjust Procfile and add webapp-runner as dependency to pom.xml
Procfile:
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
More info is in the Heroku doc
I have written a discord bot using the javacord library and it works very well because if I run the program in IntelliJ idea, the bot is online on Discord (and I can use it).
When I upload the bot to heroku, I can use it for a few minutes and then I get these errors:
2019-02-04T22:21:01.000000+00:00 app[api]: Build started by user aa#aa.com
2019-02-04T22:21:15.414268+00:00 heroku[web.1]: State changed from crashed to starting
2019-02-04T22:21:19.806474+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar warbot.jar -server.port=22270`
2019-02-04T22:21:14.200586+00:00 app[api]: Deploy dc88e3ab by user aa#aa.com
2019-02-04T22:21:22.813747+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-02-04T22:21:22.825641+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2019-02-04T22:21:23.528694+00:00 app[web.1]: 2019-02-04 22:21:23.469+0000 INFO org.javacord.core.util.logging.ExceptionLoggerDelegateImpl No Log4j2 compatible logger was found. Using default Javacord implementation!
2019-02-04T22:21:27.268649+00:00 app[web.1]: The bot has started
2019-02-04T22:21:14.200586+00:00 app[api]: Release v25 created by user aa#aa.com
2019-02-04T22:21:24.000000+00:00 app[api]: Build succeeded
2019-02-04T22:22:50.697048+00:00 heroku[web.1]: State changed from starting to crashed
2019-02-04T22:22:50.530237+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2019-02-04T22:22:50.530363+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-02-04T22:22:50.678651+00:00 heroku[web.1]: Process exited with status 137
Basically, after a few the bot crashes. How can I fix this?
Many answers online mention the Spring framework but I am not using it! And the solution that involves -Dspring.server.port=$PORT does not work. I have this in my Procfile:
web: java $JAVA_OPTS -jar warbot.jar -server.port=$PORT
Where warbot.jar is the jar in the same location as the Procfile (which is in the root). How can I fix this? It seems that the above line is not enough to set the port.
I basically have to set the PORT so that heroku does not complain and my bot can stay online!
As i had created a jar from my project, i had started running it from linux terminal using the command
java -jar snapShot.jar
By running this my project works fine and gives console output as
INFO 2018-06-26 13:34:25 [main] -Registering beans for JMX exposure
on startup
INFO 2018-06-26 13:34:25 [main] -Tomcat started on port(s): 8080
(http)
INFO 2018-06-26 13:34:25 [main] -Started DomainApplication in 12.143
seconds (JVM running for 12.662)
I have another Tomcat in my local system. Apache Tomcat Version 8.5.29 .
But while running the jar file in terminal i found another tomcat service is running. Actually which gets started?
I just finished creating a simple Discord bot in a runnable jar. (As a disclaimer, when it comes to the web, I'm a noob.) I was looking for a way to freely run it online and I read about all these VPS sites, but none of them offered unlimited free plans. So I stumbled into a site called Heroku, which allows me to run it for a good portion of the month. I've mostly figured everything out, but there is this one error that I've been unable to fix:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
My Discord bot does not connect to Heroku's server and I think thats the problem, but I have no clue how to fix it. Has anyone encountered a similar problem? Am I going about hosting my bot the right way? Thanks.
Edit: Here is the full logs:
2016-06-11T17:00:56.792783+00:00 app[web.1]: 17:00:56.792 [main] DEBUG d.btobastian.javacord.ImplDiscordAPI - Requested gateway wss://gateway.discord.gg (token: **************************************************NdxxxW0oQ)
2016-06-11T17:00:56.765456+00:00 app[web.1]: 17:00:56.765 [main] DEBUG d.btobastian.javacord.ImplDiscordAPI - Requesting gateway (token: **************************************************NdxxxW0oQ)
2016-06-11T17:00:57.199263+00:00 app[web.1]: 17:00:57.199 [ReadingThread] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Sending connect packet
2016-06-11T17:00:57.267527+00:00 app[web.1]: 17:00:57.267 [ReadingThread] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Received READY-packet!
2016-06-11T17:00:57.270636+00:00 app[web.1]: 17:00:57.270 [ReadingThread] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Updating status (game: none, idle: false)
2016-06-11T17:01:38.508359+00:00 app[web.1]: 17:01:38.507 [pool-2-thread-1] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Sending heartbeat (interval: 41250)
2016-06-11T17:02:19.751552+00:00 app[web.1]: 17:02:19.751 [pool-2-thread-1] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Sending heartbeat (interval: 41250)
2016-06-11T17:02:22.866430+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2016-06-11T17:02:23.649874+00:00 heroku[web.1]: Process exited with status 137
So my application does not actually interact with the Heroku server and it "times out" appartently. When I run it locally, all is well, but when I upload it to a Heroku application, it "times out." I've looked for ways to bind the $PORT but been unsuccessful so far. I've inluded it in my Procfile with no results:
web: java $JAVA_OPTS -Dserver.port=$PORT -jar ideaprojects.jar --host=0.0.0.0 --port=$PORT
I've never interacted with ports before, can someone help me out? Thanks again.
Edit2: I even tried to run my bot through their "java-getting-started" by adding my Java code to the end of theirs. Heroku doesn't crash, but it seems that my bot doesn't run either.
You are getting this error because your Procfile configured as web. You need to configure Procfile as worker process.
You can try this Procfile configuration: worker: java -jar target/*.jar
Also you can to look this page: https://devcenter.heroku.com/articles/run-non-web-java-processes-on-heroku
Heroku is for hosting web applications. It is not intended for hosting processes that aren't part of a web application you're running on Heroku, and trying to run such a process will not work well.
You will need a VPS to host your bot. Yes, you have to pay for this.