I have a multi-module Maven project that is a Java web application. I am using Eclipse as my IDE and am wondering if there is anything in WTP that will allow me to add/delete/modify Java classes without doing
"mvn clean install" and,
restarting the application server?
Edit: I've seen JRebel and watched some videos, but it doesn't support CXF or GWT and it seems to me that Eclipse/WTP should do something like this out of the box, yes?
JRebel does support CXF and GWT - refer to the features page http://www.zeroturnaround.com/jrebel/features/frameworks/
Most web containers allow you to perform hot code replacements but there are a number of limitations, such as:
Changing the class/method signature will not work - you have to redeploy and restart
Changing a "stack frame" call (e.g. Main) generally will not work either.
Check out this link for instructions on how to set it up for WTP.
Check Dynamic Code Evolution VM (DCEVM). You do not need to install anything specific in eclipse. Check if it works with CXF. GWT already supports hot deployments in hosted mode, with some limitations. For example, if your server is Jboss, check this.
Related
Has anyone managed to build out a way to use Sublime Text 2 (or 3) instead of eclipse for their java-based app? We've got java in eclipse (mac), with maven and git support. We don't 'build' in eclipse, per-se. Instead when necessary we just either refresh the projects or restart the tomcat server--usually though, we can just make changes and reload the browser.
To be clear, the app is single-page-architecture built on java/mysql, with a dojo javascript framework on the front end.
Suggestions?
There is no problem with switching to SublimeText2/3 in almost any language.
There are multiple git packages that help you with using it, such as full integration, merges and everything else you may need.
Even if you would build or simply needed to restart the tomcat server you can write your own build system that will run everything you need just like you would manually do in terminal.
SublimeText works exceptionally well with JS and it's frameworks as well as code-in-code - different languages one in another.
Maven package is available
Now to the parts that you would probably miss when switching from other IDE's.
IntelliSense - SublimeText has a package named CodeIntel that will help with that, but it's not working that good in comparison to other IDEs.
MySQL - SublimeText has no way to integrate DB management.
I'm interested in doing some Java web development but I'm not really interested in using Eclipse. I have used Eclipse in the past and to me it seems to add a layer of abstraction that I'm not really interested in. However, I'm having a bit of upstart problems.
Does anyone have any good references/tutorials in getting up and running with Java web development without using Eclipse (or any other IDE for that matter)?
Create a maven project and use one of the embedded web servers like jetty or Glassfish.
Also, this approach allows you to work with the command line directly or use either Netbeans, Eclipse or IntelliJ as your IDE as they support Maven projects. I do not think that JDeveloper can yet.
(Eclipse may require the m2e plugin from the marketplace, and it handles all the Eclipse configuration transparently and directly. Highly recommended).
You can easily do java web development using notepad only. The extra work is, you have to write some extra code (like in servlet you have to write web.xml http://www.tutorialspoint.com/servlets/servlets-first-example.htm). Same in Struts, Hibernate and Spring framework, you have to write config file in notepad.
I have created an entire site which includes Jsp and html pages,servlets,java files,and i have used msaccess as the db.All thse have been created using eclipse.What is the best way to deploy this on the web?and how do i do it?
Any help is appreciated.
Thanks
This is what the WAR-format is designed for.
Look into how to package your stuff in a WAR form and use that. Note that very few sites offer both Java and Access. You may want to consider being database agnostic.
do you already have a "java-capable" webserver running somewhere? Are you going to host it yourself or are you going to deploy it to some server hosted by some company?
As YK-47 already said tomcat (http://tomcat.apache.org/) in conjunction with apache webserver is a good choice. You might also want to have a look at jetty (http://jetty.codehaus.org/jetty/)
As soon as you have the server running and accessible over the web you can deploy any java based web application there (i.e. a war-file).
A War file is definitely the easiest method.
If you turn your project into a Maven project it can automatically generate a war file for you, and even deploy it to a webserver if you set it up to do so.
m2eclipse is the plugin you need to get for eclipse, you can then right click your project and go to Configure>Convert to Maven Project. Once this is done look in the Pom file it generates for you and select your output to war (I think by default it might be jar)
If you are new to Maven their website has a quick start guide which may be worth running through which will get you up to speed fast
5 Minute Test
It is worth he effort to learn how to use Maven as in the long run will save you a lot of time... as you wont have to write build scripts
Currently we have a Java Restlet API with dependencies controlled via Maven. When we update the API we run maven assembly:assembly which does the unit tests etc and produces a single jar file. We then upload this to the production server and run it using nohup.
Is there a better or more automated way of doing this? Is this where something like Hudson would come in?
Thanks
My experience goes with webapp-deployment. But same should hold true here. Use Maven, Cargo, Nexus (or Artifactory), Hudson and probably, Jira in conjunction of product release.
Automated release process are more reliable because there is no human factor involved that may forget a step.
We also use Liquibase for database versioning. And, if you are dealing with database changes in your application deployment. You'll realize Liquibase boosts so much confidence while running alter scripts.
I would suggest to go through the following resources
Automated Deployment with Maven - going the whole nine yards If you can, literally follow this pattern.
Maven 2 Effective Implementation -- this book really helped us a lot.
There are several Maven plugins to help deployment. The most general of them is Cargo, but there are also app server specific plugins for some concrete servers like JBoss.
Most companies I have worked for (actually, all) have had some sort of custom in-house built deployment system; even if build was done using a standard framework (like Maven in use at my current company).
Part of this is because there are many aspects that tie closely to company-specific infrastructure, capacity management and monitoring systems; and so even though there are open-source systems, there is usually something that needs to be tweaked.
It sounds like you are running your app on its own--it isn't part of any application server. If you aren't using an application server, there are probably some ways to get cargo and maven to deploy it for you, but you may be better off just using some shell scripts to deploy and run the application.
However, as your application grows, you may find a need for an application server like Jetty, JBoss, Glassfish, Tomcat, etc. When this happens, take a look at the cargo plugin for Maven because it will allow you to do something like:
mvn cargo:redeploy
That will package up your application, send it to the server and restart the app. If you want Hudson to do this for you automatically you can add it as a target to build.
Cargo can save you a lot of time when you have to frequently update an application server.
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.