How to create Procfile for playframework app deploy in Heroku? - java

i developed a small play framework web application and i am deploying it online on heroku then i went through steps of how to deploy app in heroku ,i followed all the steps and i am having free account, i am getting error when i am running this command heroku ps in command line.
i wrote in Procfile :
web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL}
Error is :
rahul#inext:~/EntWebPrj$ heroku ps
=== web (1X): `target/start -Dhttp.port=${PORT} ${JAVA_OPTS}`
web.1: crashed 2013/08/21 15:29:19 (~ 4m ago)
and it is also not running on my app link it is showing some application error.
anyone give some idea to fix this error?

Related

HeroKu - Gradle SpringBoot - H14 Error Deployment

I recently run into an "H14 Error" While Trying To Deploy Gradle Spring Project into the HeroKu platform.
Error:
code=H14 desc="No web processes running"
In My Project Folder, I have a "Procfile"
web: java -jar build/server/webapp-runner-*.jar build/libs/*.war
web: java -jar target/ClockGUI-0.0.1-SNAPSHOT.jar
heroku ps:scale web=1
I have researched many solutions but not worked out.
Please help me. Thank you so much
There are at least two issues with your Procfile:
You can't declare two web processes.
What command runs your web server? That's the only one that should be declared this way.
(I'm not sure what ClockGUI-0.0.1-SNAPSHOT.jar is supposed to be, but assuming "GUI" means something like SWT, Swing, or JavaFX, it won't work on Heroku. Where would the interface appear?)
You've included a Heroku CLI command.
heroku ps:scale web=1 is a command that you might run locally to scale your application's web dynos. It's not something that should be baked into the application source code.
Consider an e-commerce application. At certain times of the year, you might see a spike in traffic. You could use this command to scale up additional web dynos to handle the load. That doesn't (and shouldn't) require redeploying the application.
Remove that line. It doesn't do anything in the Procfile anyway.
Commit the updated Procfile and redeploy. Then, if you don't have any web dynos running, run heroku ps:scale web=1 in a terminal, ideally from your project directory so Heroku can infer which app you want to scale.

How can I deploy a java web app to heroku?

I have a Java web app with Tomcat embedded in my jar file. I can containerize the app with Docker and run it with command java -jar -myapp.jar, but I can't run that container in Heroku. I tried using heroku CLI to dockerize and deploy, but Heroku gives me an error of "can't access jarfile".
I tried to fix this by using heroku deploy:jar to deploy my fat jar, but this erroneously gives me an error:
heroku deploy:jar target/*.jar -a medscanner2
-----> Packaging application...
- app: medscanner2
- including: target/medscanner2.jar
! ERROR: Could not get API key! Please install the Heroku CLI and run
`heroku login` or set the HEROKU_API_KEY environment variable.
! Re-run with HEROKU_DEBUG=1 for more info.
!There was a problem deploying to medscanner2.
!Make sure you have permission to deploy by running: heroku apps:info -a
medscanner2
I am signed into Heroku and I can use heroku auth:whoami to verify that, I can push containers and deploy them, so this error doesn't make any sense. I reran with HEROKU_DEBUG=1 and it did not return any more info.
I further tried to set the HEROKU_API_KEY variable in the CLI with a token I got from Heroku and this still caused the same error when I try to deploy the jar.
I am using a Procfile (although I am not sure it is necessary):
web: java -Dserver.port=$PORT -jar target/medscanner2.jar
Since the issue seems to be indicating there is an issue with access I don't see how the Procfile could be influencing it.
What is the best way for me to deploy a Java web app that does not using Spring Boot to Heroku? I have separately deployed the docker container successfully to Google app engine, so all this work for Heroku is very frustrating.
I ended up fixing this by using webapp-runner to deploy my app. It runs the webapp-runner jar which can run your .war files. This required adding the heroku-maven-plugin and maven-dependency-plugin.
I could then add a Procfile: web: java -jar target/dependency/webapp-runner.jar target/*.war --port $PORT
and use the Heroku CLI to add the app using git. The link with webapp-runner is a guide to deploying tomcat java apps with webapp-runner.

Deploying to heroku successful but application not appearing

I created a simple Java (maven) web application (WAR). On local Tomcat all works fine, however when I try to deploy to HEROKU the application does not show up (I get error instead on the home page of the app.
I run this command
heroku war:deploy myapp-ws-0.0.1-SNAPSHOT.war --app myapp-ws
and all actions are successful
the only parameter that I need on Heroku for my app to run is spring profile and I added it this way.
heroku config:set -Dspring.profiles.active="true"
I'm very new to heroku, but did anyone in the past deploy a war to heroku successfuly? I cannot find the problem, no error appears apart from the home page saying application Application Error. Any other information I should include here?
Ok, I got it working, first I was able to check logs:
heroku logs --tail --app myapp-ws
then I found out that you have to add one instance because at start there are zero
heroku ps:scale web=1
and finally I added my arguments in this way
heroku config:set WEBAPP_RUNNER_OPTS="-Dspring.profiles.active=test" --app myapp-ws

How to Host a Struts/Spring Web application project on Website for beginners?

How to deploy java web project on website, how to host simple java web app online on website.
Any free web hosting websites? for beginners
Heroku provide some free plane which is ideal for experimenting with cloud applications in a limited sandbox.
heroku
If you have git account, and install heroku in local machine then use follow
commend:
git add .
git commit -m "Added a Procfile."
heroku login
Enter your Heroku credentials.
...
heroku create
Creating arcane-lowlands-8408... done, stack is cedar-14
http://arcane-lowlands-8408.herokuapp.com/ | git#heroku.com:arcane-lowlands-8408.git
Git remote heroku added
git push heroku master
...
-----> Java app detected
...
-----> Launching... done
http://arcane-lowlands-8408.herokuapp.com deployed to Heroku
And it's easy to deploy web app on it
Here
is a doc of heroku to deploye the java web app doc.
Also you can use AWS, it's provide one year free plane with limit of data.

Running web-application on Heroku

When I'm trying to run my Play! application on Herocu I have a message that I should run it with "play -DapplyEvolutions.default=true" command. But how can I do it?
Now what I'm doing is pushing to my webapp to heroku and operate with commands: "heroku ps" and "heroku logs". The last one gives me error details. How can I run application on heroku remotely?
Is this Play 2? If so you will need a Procfile containing:
web: target/start -Dhttp.port=$PORT -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=$DATABASE_URL

Categories

Resources