Take the 2-minute tour ×

I'm looking for a light-weight and simple servlet container for rapid development. For example I want to write Java code without recompiling every time to see the changes in the browser. And I don't care for the servlet to be able to handle thousands of concurrent requests since I only need to install it on my local Windows machine and I will be the only one accessing it.

I'd like this sort of thing for development, so that I can upload my war to my "live" servlet container that has a more mature servlet container (Tomcat etc).

Does anything like this exist?

share|improve this question

3 Answers 3

up vote 10 down vote accepted

Jetty with the Jetty Maven plugin will be your guiding light.

share|improve this answer
Thanks I'll try it. Can you tell me a bit more about the compilation part? Can you just change a .java file and it automatically compiles it? Or how does it work? –  Luca Matteis Mar 3 '11 at 21:30
With the jetty maven plugin, you can configure it to scan your source directories for changes to your files. It will then pick up the change, compile it, and hot swap it into your app, or whatever you configure it to do. –  Jeremy Heiler Mar 4 '11 at 0:26
I've configured the plugin but it doesn't seem to auto deploy when I make changes to .java files. It works find for jsps/static stuff but not for my Java files. How come? –  Luca Matteis Mar 6 '11 at 20:02
I can't really help you with out seeing what you've done... (The jetty plugin page has a note about manual vs automatic reloading...did you read that?) –  Jeremy Heiler Mar 6 '11 at 22:30

The most lightweight servlet container that I'm aware of is Jetty. I'm not aware of any servlet container that provides automatic reloading of classes, but you can achieve this using the JRebel IDE plugin. JRebel is not free, but it's cheap, and well worth the money.

share|improve this answer

Yes, this is possible as you describe with Eclipse and WTP. Eclipse will rebuild your code and redeploy it to (eg) tomcat or jetty on every save. It is also possible with the maven-jetty-plugin, if you happen to be using maven.

But the overhead of shutting down the server and bringing it back up is very slight (>1s) if you use Jetty. If you are happy to do this then you have many more options available to you, like custom build scripts, maven-cargo-plugin, etc

I have recently switched away from trying to keep one long-running tomcat, to spinning up and killing dozens of instances of Jetty, and it's working fine.

Edit: Beware, though, Jetty and Tomcat have different behaviour sometimes. For example the the serving of static files via the default servlet.

share|improve this answer

Your Answer


