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.
Related
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.
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.
What it is the best combination for fast development Java EE projects in Eclipse.
What i try to get is
Fast application server start
Hot deploy in both web-app and ejb modules.
Editing jsp without server restart
I found out for myself that best choice when developing webapp application is using WTP for Eclipse with maven plugin.
It give me all feature of WTP and also provide with up-to-date building script, that can be used outside of Eclipse, and also it simplify jar management.
I'm looking for something similar when developing Java EE application. What is the best combination of Java EE server(should i use Jboss or Glassfish) and Eclipse plugins ?
WTP is completely sufficient:
it allows you to start and stop servers and redeploy applications (see the Servers view)
allows hot swap - i.e. replace the class on save (unless you have made structural changes) (just start the server in debug mode)
jsp pages can be edited without restart with default configuration of most servlet containers.
I am developing a GWT application that uses EJB and other Java EE 6 technology as the backend. I am currently using the GWT 2.0 plugin for Safari.
When I change my GWT client side code and save in my IDE (NetBeans), all that's required is a simple reload in the browser for the changes to become active. That works great!
However, often I work on the server-side (the EJBs, GWT server code, etc) and then something in on the GWT client side. Any changes done to the server-side do not appear to incrementally deploy to the Glassfish V3 server. Currently I close the GWT Development Mode application, and then recompile the EJBs, and then go back into GWT Development mode. That is tedious.
Any better way of doing this? I tried the "deploy on save" option in NetBeans but it does not seem to do the trick.
The trick is to create an exploded ear directory (instead of an ear file) and deploy that in your application server. It works in JBoss and Weblogic, and should work in glassfish, but haven't tried it.
The idea is that you don't use any archives at all. In you war directories, create a WEB-INF/classes folder, and configure your IDE to write the class files in this directory. That way, when you change a java file in your IDE, it will write to your classes directory and the JVM will hot-deploy your classes.
There are some restrictions with this approach. If you change a method signature or add a class or new method, JVM cannot pick it up. In such cases, touching web.xml redeploys the WAR. This in itself is an improvement from restarting the entire application server.
It takes an hour or two to get the right setup, but after that you will just love it.
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.