The Artima Developer Community
Sponsored Link

Java Community News
Jetty for Development?

6 replies on 1 page. Most recent reply: Nov 1, 2006 7:02 PM by Roshan Sam

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 6 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Jetty for Development? Posted: Jun 15, 2006 9:05 AM
Reply to this message Reply
Summary
While Tomcat is the reference implementation for the Servlet and JSP specs, and is also the most popular servlet container, the open-source Jetty provides a light-weight alternative servlet engine. Ethan McCallum's recent OnJava article introduces Jetty, and shows where Jetty is more appropriate to use than Tomcat.
Advertisement

While most developers looking for an open-source servlet engine start out with Tomcat, Jetty has a been a steady light-weight alternative. According to Ethan McCallum's recent OnJava article, What is Jetty?, Jetty has been in active development since 1998, and now serves as the servlet and JSP component in frameworks such as Apache's Geronimo.

Among Jetty's more intriguing features are its slight weight both in terms of memory footprint and startup time, especially compared with Tomcat. McCallum's article mentions embedded uses of Jetty, as well as uses in unit tests, where Jetty can drive the server-side of a test case. Another potential use of Jetty might be during development.

At Artima, we currently use Tomcat both for deploying the site, and also for development. Tomcat seems to be highly performant in a deployment scenario, and but we often find that Tomcat's relatively heavy-weight startup process becomes an impediment to quick test and develop cycles. For instance, when recompiling a servlet or JSP, we often have to wait for Tomcat to reload the servlet code, and perform some other initialization, before we can test and exercise that code.

While we have already incorporated Jetty into our unit tests—it drives the server-side of tests for reading and parsing RSS feeds—we have yet to do that for development. Do you feel that Jetty's light-weight approach can result in quicker test-develop cycles of servlets and JSPs? What servlet engine do you use during development?


Jim Carroll

Posts: 7
Nickname: mrmaple
Registered: Jan, 2006

Re: Jetty for Development? Posted: Jun 15, 2006 10:25 AM
Reply to this message Reply
Jetty is great for development.

I worked for a few years on a website http://neuroinformatica.com and we used Jetty for our .jsp and Servlets. Our goal was to create a very low-maintenance web server that we could productize and create an installer so our customers could set up their own servers.

We could configure it in source code, which had the advantage that there were fewer xml files for the customer to break. Customers who needed it could create configuration files and set up https: / SSL if they required it.

We also have a database and image server 'engine' which we could expose by putting some variables in the server context. Each JSP page would get an instance of the neuroinfo object, and then use that for all database queries, persistence, logins, and lucene searches.

Unfortunately, we fell pray to a company who claimed they patented the entire field of virtual microscopy. (Google maps would be vulnerable to the same patent if they ever served a map where the image was from a camera on a microscope instead of a sattelite!) Jetty, of course, had nothing to do with the Patent violation.

Jetty treated my company very well, and I highly recommend it.

-Jim

Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Re: Jetty for Development? Posted: Jun 15, 2006 11:20 AM
Reply to this message Reply
> Jetty is great for development.
>
> I worked for a few years on a website
> http://neuroinformatica.com and we used Jetty for our .jsp
> and Servlets. Our goal was to create a very
> low-maintenance web server that we could productize and
> create an installer so our customers could set up their
> own servers.
>

One area I'm really interested in learning about is using Jetty - or even Tomcat properly - in a development environment. I'm finding that as a project grows to hundreds, and then possibly to 1000s of classes, files, etc., quick test-edit-compile-view cycles get longer and longer. One culprit surely is Tomcat in our case, because every compilation is followed by a lengthy period it takes for Tomcat to reload the new classes and resources.

Ideally, what would be nice is a server that (a) ran with a small memory footprint, (b) had only the ability to execute servlets and JSPs, and (c) was very fast in reloading just the resources that changed.

I know that Tomcat works relatively well in that fashion for a smaller project, with just a few hundred classes/resources. But I'm finding that things are coming to grinding halt as the project grows.

How well does Jetty fit that bill? And how does it compare to Tomcat for these purposes?

What do you use for development when you want quick test/edit/compile cycles?

Jim Carroll

Posts: 7
Nickname: mrmaple
Registered: Jan, 2006

Re: Jetty for Development? Posted: Jun 15, 2006 12:28 PM
Reply to this message Reply
> What do you use for development when you want quick
> test/edit/compile cycles?

I have to admit, I evaluated Tomcat early in the process, and had a two page procedure on all the xml edits necessary to set the server up for our purposes... and then found Jetty and didn't look back.

My application was mostly .jsp, and with the auto-releoad feature of Jetty, the edit/compile/test cycle is really just 1) edit the jsp, Ctrl-S for save 2) alt-tab switch to browser and 3) ctrl-R reload. Jetty (for those who aren't familliar) invokes javac on a servlet that is generated from your .jsp page, loads that servlet's bytecode dynamically, and uses it on the next page request. Jetty can also use IBM's lightweight jikes java compiler for even faster iterations.

When we were working on our servlets, we would have to stop the server, edit the servlet, use ant to do a servlet build, start the server and test again. I don't remember it ever taking more that 10 - 20 seconds for stop/compile/start iterations. Jetty always started in under 5 seconds, no matter how many servlets we had. (we were adding the servlets to the server context using code instead of xml files, so I wonder if that helped.)

Of course, the startup time for the various database connection pools (or whatever) you're using adds to the delay. We used (the very nice) HSQLDB for our database (although we could also connect to MySQL or MSSQL.) So HSQLDB startup time was just about instantaneous with a small database as well.

We never had any complaints about slow edit/test cycles, and we never ran into any limitations that Jetty couldn't handle. Two thumbs up!

-Jim

darryl west

Posts: 2
Nickname: darrylwest
Registered: Jun, 2006

Re: Jetty for Development? Posted: Jun 16, 2006 2:48 PM
Reply to this message Reply
we have used jetty for three projects. our first was a small pilot, that is now running in production. the second is now in beta and should go to production in a few weeks. the third is in alpha and running on multiple servers, and as a standalone development/test environment.

we use the jetty 6 beta version (17). it seems quite stable, at least as a servlet container. we also use tomcat, but are slowly replacing it with jetty.

other projects we have worked on use weblogic and sun-one. all i can say is that for our projects, they seem to be extreem over kill. weblogic 9 (as of march-2006) has so many bugs, that it's worthless for any size project.

Stefan Kleineikenscheidt

Posts: 1
Nickname: skleinei
Registered: Sep, 2005

Re: Jetty for Development? Posted: Jun 17, 2006 6:27 AM
Reply to this message Reply
Hi Frank,

have you seen Jetty's Maven 2 Plugin? Just by typing mvn jetty6:run you will get a running Jetty, which automatically checks for changes. Works like a charm, more info here: http://blogs.codehaus.org/people/brett/archives/001306_developing_with_jetty_where_have_you_been_all_my_life.html

-Stefan

Roshan Sam

Posts: 1
Nickname: roshan99
Registered: Nov, 2006

Jetty for Development? Posted: Nov 1, 2006 7:02 PM
Reply to this message Reply
Guys,

I need a big help here. I am totally new to this Serverlet.
I read an article about creating a did you mean word suggestion at the following url;
http://today.java.net/pub/a/today/2005/08/09/didyoumean.html?page=1

I instal Jetty server and trying to implement this; dont know how to get the servelet work ? Step by step help on this greatly appreciated.
Thanks in advance.
Roshan
Roshan_m_2003@yahoo.com

Flat View: This topic has 6 replies on 1 page
Topic: Jetty for Development? Previous Topic   Next Topic Topic: TestNG 5.3 Released

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use