Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Jetty 6.x versus Tomcat 6.x

An AppFuse user asks:

Has anyone done any performance benchmarking between Jetty 6.x and Tomcat 6.x to see which one is better for production use in terms of scalability, performance and ease-of-use? I'm gearing towards Jetty 6.1 but want to hear other's opinions first.

I admit, I completely changed the wording in this quote to make it more readable.

Most of the companies I've worked with in recent years have been using Tomcat (very successfully) in production. However, I also know the Contegix and JavaLobby guys continue to swear by Resin for the most part. What's your opinion?

IMHO, I don't think it really matters - they're all good enough for production use.

Posted in Java at Aug 15 2007, 09:50:17 AM MDT 7 Comments

My current project uses both. We use Jetty for basic, local testing and we're about to start using it for continuous integration testing with Selenium. We like it because it's so self-contained. I want as much control over my test environment as possible and using Jetty with Maven gives us that kind of control (not to imply we couldn't do pretty much the same thing with maven + tomcat + cargo too - but we don't). For staging however, we use Tomcat. I think the choice to go with Tomcat for the higher tiers is mostly just out of habit and the perceived pervasiveness of Tomcat (versus Jetty or Resin). Our app is so self-contained already, in that it doesn't rely on app-server services from bigger, fuller-featured servers like JBoss AS, that in the end, it likely doesn't matter what we run on.

Posted by Terry C. Martin on August 15, 2007 at 11:55 AM MDT #

Resin (w/ JRockIt JVM)

Posted by Vic on August 16, 2007 at 07:15 AM MDT #

Development - Tomcat standalone Production - Apache Web Server and Tomcat with AJP connector.

Posted by SM on August 16, 2007 at 09:17 AM MDT #

I don't know that you can embed Tomcat as well as you can embed Jetty. Once you get into testing with an embedded webserver it is very nice. Plus with webdriver giving you an embedded browser, web testing is looking a lot sweeter for me.

Posted by Joe Walker on August 16, 2007 at 04:16 PM MDT #


Terrible simple to embed Tomcat:

File CATALINAHOME = new File("./var/catalina");
File WEBAPPS = new File(CATALINAHOME,"webapps");
File ROOT = new File(WEBAPPS, "ROOT");

Embedded server = new Embedded();

Engine engine = server.createEngine();

Host host = server.createHost("localhost", WEBAPPS.getAbsolutePath());

Context context = server.createContext("", ROOT.getAbsolutePath());


Connector http = server.createConnector("localhost", 8282, false);
//Start the server 

Pretty easy ;-)

Posted by on August 17, 2007 at 10:17 PM MDT #

Hi, and how do you register servlets (not whole war files) to the context? Thanks!

Posted by RPR on April 10, 2008 at 04:50 AM MDT #

I just tried embedding both Jetty 6 and Tomcat 6. Jetty was much easier to get installed and running. I eventually went with Tomcat, though, as I couldn't get the Jetty JSP compiler to handle Java 1.5 constructs.

For those needing an example of how to embed Tomcat 6, here's my code:

    String noIdeaWhatThisDoes = absolutePath("build");
    String app = absolutePath("build/dist");
    tomcatServer = new Embedded();
    Engine engine = tomcatServer.createEngine();

    Host host = tomcatServer.createHost("localhost", noIdeaWhatThisDoes);

    StandardContext context = ((StandardContext) tomcatServer.createContext("", app));

    Connector connector = tomcatServer.createConnector(InetAddress.getLocalHost(), port, false);

The bit about the default web.xml is to get the standard behaviors you'd expect from Tomcat, like processing JSPs. I just made a copy of conf/web.xml and trimmed it down. The work directory bit is necessary to keep it from using your library directory as a scratch area. And the app path should be the absolute path to your unpacked WAR. From the code, you may also be able to give it the WAR, but I didn't check.

Posted by William Pietri on January 19, 2009 at 07:06 PM MST #

Post a Comment:
  • HTML Syntax: Allowed