Heroku inquiry, running a Java application on Heroku - java

I am trying to deploy and run a Java application on Heroku. It is a small application. And it comes with a database.
Questions:
on the Heroku website tutorial, it requires having Maven 3 installed.
Only Maven web application runs on Heroku? How about a non-Maven Jave EE application?
The application is just a simple RESTful web service. After push the application to Heroku, it is not running.
It seems to me that a database has been created. But it showed error when tried to open the app. Do I have to create another database and do some configuration?
I am new to this and have no clue. Can anybody shed some lights on this?
Thanks.
When I try to heroku ps:scale web=1
it returns
Scaling dynos... failed" ! No such process type web defined in Procifile.**
What is Procifile and where is it?

What is Procfile and where is it?
The Procfile tells Heroku how to start the different processes for your application (web, worker, etc). You define it at the root of your project. See https://devcenter.heroku.com/articles/getting-started-with-java#define-a-procfile
Only Maven web application runs on Heroku? How about a non-Maven Jave EE application?
The Maven dependency is about being able to build the application; it is not a strict requirement, as Heroku supports builds with different "build packs", including Gradle. See https://devcenter.heroku.com/articles/buildpacks
That said, if you still want/need to use a tool to build a .war locally, you can deploy that directly. See https://devcenter.heroku.com/articles/war-deployment
In general, though, your life will be easier if you follow the practices outlined in the article Getting Started with Java on Heroku because the Heroku framework implements 12 Factor architecture, which enforces simplifying constraints on your architecture, and encourages automation and repeatability in builds and deployments.

Related

Need help to deploy Java web application

Hi I'm totally new to development. I'm trying deploy a web application on a local server like glassfish/tomcat. Backend of the app is written in Java and ui is created using HTML/css/js . I'm using maven as well. I'm not able to find a way to get this running on intellij CE .
Apparently this functionality is not supported in CE. Can someone suggest a turnaround or a different IDE as good as intellij idea. I've tried eclipse but I didn't find it completely useful
Thanks
There is no IDE as good as IntelliJ. JetBrains makes the best IDEs on the market.
No, I don't work for them. I have no affiliation at all. I'm just a satisfied customer for the past 13 years who is happy to buy a license with my own money every year.
The comparison matrix for community and ultimate editions makes it clear: You cannot deploy in IntelliJ without a licensed copy.
You can create a WAR file and deploy it manually to Tomcat or Glassfish if you wish. Why not just do that?
I will compliment you on how you are approaching the problem. IntelliJ, Maven, and your other choices are very good.
If you feel up to the challenge, you can look into Spring Boot. You can run an executable JAR and leave Java EE app servers behind. IntelliJ community can easily run a Spring Boot app.
Choosing Spring Boot does mean leaving EJBs behind. Everything you can do with Java EE is available in Spring Boot. You'll be using POJOs.

Launch a Java web application on internet

I have a project made with Eclipse or Netbeans, it's a Java web application, I would like to deploy this application on web, using a free server, It's only a trial for to learn how function, Could you explain how I can do it ?
You need an application server that supports Java. Tomcat, JBoss, Jetty, any one who fits your needs. Then, just upload your war file into webapps folder (for Tomcat) and it will do the work for you.
You can check here some free or trial services that should be enough for learning.
Then, when you kickass deploying web apps, just subscribe some java application server service or, as I do, rent a VPS and install all you need. Give you some more work, but much more flexible. I've been using ovh VPS and for the price, I'm very happy. Good luck ;)

Should I use Eclipse wizard to deploy web application?

I use Eclipse "Dynamic Web Project" to create and test web application. It will publish my application on application server in convenient way. I don't need to write script, just wizard.
However, I am wondering it is a decent way to deploy a web application. What's your opinion? Thanks!
(I used to use Ant script to deploy my application, it's standard way.)
plus: Dynamic Web Project uses its specific directory layout which is different with Maven standard directory layout.
This is fine for deploying to a dev or test server. Its a convenient way to quickly deploy to have a look at changes you've made and to do tests.
I would definitely not allow this for any other environment, eg live, pre-production etc. You should have an established process (eg documented change control) to deploy to these environments.
I have heard it's still recommended to cold deploy and restart the server for not having a trouble with memory leaks, dynamic class loaders. For myself I think comfortable to deploy from Eclipse to most environments. Basically Eclipse WTP server adapter can run the same deploy command as the other processes. When I use clouds like GAE or Beanstalk I do deploy from Eclipse plugin, it is the same like command line.

Installation best practices for a web application

I have a simple web application which will be running on machines which don't have internet connectivity.
I would like to support the ability to install, remove and support migration of WAR at a later stage. This would be our deployment scenario:-
The machines might not have Java and we would probably have to install it before deploying the application.
The web application (WAR) runs on top of jboss application server.
The application server needs to be run as a Windows service
The entire application will be shipped in a CD.
I don't want to spend too much time on building an installer, but what should we do support the above scenario? Are there any tools which help in handling this?
I recommend using a MSI package with an EXE bootstrapper which supports prerequisites. This should cover all your requirements.
Regarding a setup authoring tool, it depends on what you want (free or commercial, with a GUI or with scripting etc.). You could use a Visual Studio setup project and Orca, but a commercial tool will be easier.

Common practice deploying/publish/debuggin a java webapp

I have always programmed my applications in php. But recenlty I discovered that best combination of language and server to achieve scalable comet functionality is Java + Jetty, because jetty support continuation, which eases the number of threads in the server. However, I'm slowly learning Java right now. I'm using Eclipse as my IDE with the plugin RSE(Remote System Explorer). When I used to program in PHP I just created a new php-file inside of htdocs in my Apache webserver, very simple to deploy. But now when I program in Java I have to compile the file too. Another flaw is that I cant create a Dynamic web project in RSE, so to deploy a webapp I have to drag all my file in my personal computer to my remote server and unzip and compile(manually via ssh). How do you guys deploy your java webapp in Eclipse?
And yes I haven't found any good answer to this on the web yet before asking this question.
Install a web server on your machine, and do all your development and tests locally on your machine. When the application is ready, deploy it on your remote server.
You don't have to compile it on the server. Java bytecode is portable across OSes and machines. You can build your war file on your machine and send it to the remote server.

Categories

Resources