TomcatExpert

Getting Started with Apache Tomcat Development

posted by MSacks on August 9, 2010 07:22 AM

With special thanks to Mark Thomas, ASF/VMware for reviewing.

Overview

This document will describe all of the necessary pre-requisites to get started in developing, customizing and contributing to the Apache Tomcat Project. The reader will have a broad overview of what is involved, and learn the process by which they will get a better understand of how the internals of how the Apache Tomcat application server works. Those new to the Apache Tomcat project, or contributing to an open source project may find this article helpful.

What is Apache Tomcat?

Apache Tomcat is the de-facto, open-source application server. It is distributed under the Apache License, Version 2.0 and is true open source. Many organizations use Tomcat as their production's application server, and it is enterprise grade even in its open source form. Over half of Fortune 500 companies use Apache Tomcat as their platform for their production business websites, including notables such as E-Trade.com, Walmart.com, and The Weather Channel. There are commercially supported versions of Apache Tomcat as well. In this how-to article, we will use the open source version as an example. 

Before you get started

When developing for Apache Tomcat, it can make it easier to code when using an Integrated Development Environment. This allows you to keep your source code organized, and adds useful features such as syntax validation that will allow you to program more efficiently.

Read the documentation

This is a necessary step before you start modifying the code, or going to the forums. Do a brief scan through ALL of the documentation. This way you will know where everything is at a minimum, and save yourself and others time asking and answering questions on the mailing list. If there is something that you cannot find even after you’ve read and searched the documentation, or you have an anomalous problem, then you should take your issue to the mailing list. People aren’t likely to help a lazy person who wants to skip the reading. At a bare minimum, read the table of contents of the Tomcat documentation so that you know where to go.

Setting up your IDE

Many folks have different preferences for what they like to use for their IDE. Depending on your preference and what you are comfortable with, it will vary. I suggest trying all of the main IDE’s and seeing which one you like best. Some recommendations are Netbeans, Eclipse, and IntelliJ. Some developers prefer to use a simple text editor such as vi, emacs, or jEdit.

  • Step 1. Download your IDE
  • Step 2. Set up IDE for Java development (some IDE’s require this)
  • Step 3. Organize your directory structure accordingly
  • Step 4. Set up a local Software Configuration Management System

You will want to set up a local SCM because the Tomcat project only accepts patches and modifications in the form of patches. Having a local repository enabled the developer to version their code and track changes. When doing this, it makes it much easer to work off the main Subversion repository. Most users will want to do this if they are heavily modifying Tomcat’s code. Although access to the main Subversion SCM for Tomcat is world readable, only ASF comitters can push code to this repository.

Pull the source

First, you will have to decide which version of Tomcat you would like to work on. This will vary depending on your individual or organizational requirements, but generally you will want to work on the latest or previous revision of Tomcat.

According to Mark Thomas, one of the lead developers on the Tomcat project, bugs get fixed in the latest version of Tomcat and then back-ported. “At a minimum, we like patches for the latest version”, says Mark Thomas.

Using Apache Ant for Development and Build Tasks

Apache Ant is a Java build tool. It will allow you to execute a pre-defined set of actions and configurations according to something you are trying to achieve. The Apache Tomcat project uses ant for this, and although it is not required, it is highly suggested to use ant tasks to automate your builds. Also, many IDE’s support ant integration allowing you to call ant from within your IDE, and boosting productivity.

The advantage of using ant is that it can be automated further with continuous integration servers, such as Hudson, and maintains consistent configurations of build parameters. Ant tasks are defined as targets, and a given target could be a compile, run jUnit or TestNG tests. The main configuration file for ant is in build.xml in the Tomcat source tree. Some standard actions are compile, build, clean, and run tests.

Modify the code to your needs

Now is the hardest part. You have to decide if and what you want to modify Tomcat to do. It may be that you want to add custom MBeans to your Tomcat server to monitor some very specific method of interaction with your server environment. In most cases, most committers will be contributing to the project and helping to make Tomcat better. This brings us to getting started with Bugzilla.

ASF Bugzilla

The ASF Bugzilla is where the Tomcat community searches and files bugs or software enhancements. This is where most people will be submitting patches, and attaching them to a bug or enhancement request, and then one of the main Apache committers will be checking it into the project if they and the community vote on it. Apache projects are a meritocracy. A meritocracy is government by merit. For more information about how the ASF works, see http://www.apache.org/foundation/how-it-works.html#meritocracy.

The Apache Tomcat Project uses Bugzilla for logging and maintaining it’s inventory of bugs. The Tomcat Bugzilla is not only limited to tracking bugs and enhancement request for Apache Tomcat, but all Apache projects. It should be noted that some projects may use Apache’s JIRA system.

  • Step 1. Log in to https://issues.apache.org/bugzilla/
  • Step 2. Click on the “New Account” link to enter your information and create a new account
  • Step 3. Log in with the newly created account and click “Search”
  • Step 4. In the Product drop-down, Tomcat N (N being the version number) will be able for selection. Bugs can be searched by some criteria such as being open or closed.
  • Step 5. Pick a bug or enhancement request and start working on it, or submit something completely new
  • Step 6. Attach a patch directly to the Bugzilla ticket in diff format. For more information on how to submit a patch, see http://tomcat.apache.org/bugreport.html#Patches_and_enhancement_requests.

NOTE: A user does not need a Bugzilla account to search and read bugs. A user only needs an account to submit a bug through the Bugzilla system. Anyone can submit a bug by attaching a Subversion diff as a file to the mailing list explaining the issue for review.

Conclusion

Apache Tomcat is a prime example of one of the most successful open source projects, and is highly useful and utilized by many of the Fortune 500 companies for performing their daily business functions. As a developer or system administrator, it is key to know the internals of the application, even if you are not going to be modifying the application server platform itself. Knowing the internals of an application server will reveal to you how threading works, database access, how the application server interacts with the JVM, clustering, session management, and deployments. If  you’ve made it to the end of this document you should have a good idea of entails getting involved in the Tomcat project, and why you should.

Further Reading

The Anatomy of a Bug https://issues.apache.org/bugzilla/docs/en/html/bug_page.html
About the Apache Software Foundation http://www.apache.org/foundation/
Apache Tomcat Discussion Lists http://tomcat.apache.org/bugreport.html#Apache_Tomcat_discussion_lists
Subversion SCM http://subversion.tigris.org/
Apache Ant http://ant.apache.org/

Matthew Sacks is an Application System Administrator at Edmunds.com, and focuses on administering, monitoring and managing high-volume, high-traffic production Web sites. He is also the Founder and Editor of TheBitsource.com, a blog on System Administration, Web Application Development and Software Engineering. He is an active member in the USENIX The Advanced Computing Systems Professional and Technical Association, and has contributed to such publications as Linux Pro Magazine, Sys Admin Magazine, and InformIT.

Comments

Heard that there was a

Heard that there was a request smuggling problem around the start of the year, and they managed to fix it. That was a serious issue, where an attacker could get the server to read part of a request as another request.

how to make cheddar cheese

It's understandable why so

It's understandable why so many organizations use Tomcat to conduct their daily business functions. Everything from server applications to digital voice recorders, were created for one single purpose: to help us improve our skills into delivering quality products and services, to customers.

I admit, I have not been on

I admit, I have not been on this web page in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. professionals. I thank you to help making people more aware of possible issues.
backpack

hay day hileleri So lot to

hay day hileleri So lot to occur over your amazing blog. Your blog procures me a fantastic transaction of enjoyable.. Salubrious lot beside the scene. clash of clans tipps

I appreciate your wordpress

I appreciate your wordpress design, exactly where did you obtain it from?
Mortgage Broker Calgary

As Apache Tomcat application

As Apache Tomcat application server has been developed long before so I hope everyone possesses complete details about it. I feel happy to see the basics and also the complete process to make the set-up and installing it. I remember when I tried installing Apache Tomcat in my system, I made some mistake and my system got hanged and I was afraid of losing my valuable data in it. Lastly I resolve it with the help of Tech Support Los Angeles. Anyways, thanks a lot.

This is a great tip

This is a great tip particularly to those new to the blogosphere. Brief but very precise info… Many thanks for sharing this one. A must read article!
Edmonton Mortgage Broker
Life Insurance Vancouver
Life Insurance Calgary

Getting Started with Apache

Apache tomcat, the biggest open source application server has really helped me a lot. It is really great application server and I think everyone should try this and enjoy the same. It is very simple and there are no issues till now.
dish network channels

I encourage you to read this

I encourage you to read this text it is fun described ... custom controllers uk

Re: Apache Tomcat Deployments

There is lot more information about this Tomcat and its things furnished here. I used to refer this site when I need support for issues dealing with this tomcat series and I am very much interested in reading things about Tomcat and thank you for this one!
spine pain management

I am regular reader of your

I am regular reader of your site. It discuss all the updates in apache tomcat and it clears many doubts about apache tomcat. In this article given here you have discussed about the basic things in tomcat and it helped me a lot.
sell miles

Alex

Create much more content articles about this subject you've got a great concept in order to motivate writters. other

Only a grinning visitant here

Only a grinning visitant here to share the adoration (:, btw exceptional style. termites

Alex

Create much more content articles about this subject you've got a great concept in order to motivate writters. types of college papers

I high appreciate this post.

I high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information?
drug and alcohol treatment

Jual Laptop Notebook PC HP Lenovo Printer Tinta Toner Epson Mura

wow what a great post is this... thanks for sharing boss, keep share these valuable content. Jual Lenovo

Very good web site with the

Very good web site with the exceptional good quality goods along with I’m confident this is drastically valuable. Pakistan Kurta Styles

DraftKings Promo Code 2016? Read more how to get 1 Free Entry in

For many people, this is the best solution here draft kings promo code see how to do it.

Aadi

Create much more content articles about this subject you've got a great concept in order to motivate writters. term paper writing service

This is very intriguing, yet

This is very intriguing, yet it is crucial to be able to select this kind of website link:
dřevostavby

This was a really great

This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself..
The Language of Desire

Excellent information on your

Excellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it's nice to find a website that details so much information about different artists.
click this over here now

Its a great pleasure reading

Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.

slitheriohackcheats.online

I wish more authors of this

I wish more authors of this type of content would take the time you did to research and write so well. I am very impressed with your vision and insight.
EDDM printing companies

useful information on topics

useful information on topics that plenty are interested on for this wonderful post.Admiring the time and effort you put into your b!..
The Language of Desire

A Review of the Lost Ways by Claude Davis

You have raised an important issue...Thanks for sharing.I would like to read more current affairs from this blog..keep posting.
http://thelostwaysreview.eubookshop.com/

All the contents you

All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks quotes on procrastination

ddsd

happy navratri images
dandiya songs
navratri wishes 2016

All the contents you

All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks how to install wordpress on bluehost

thomasqq

I simply noticed utilizing display this once again. Recommend what ever I needed to determine confidence via future you'll probably stay with regards to displaying this particular fantastic set up. Rebel Mouse

I can’t imagine focusing long

I can’t imagine focusing long enough to research; much less write this kind of article. You’ve outdone yourself with this material. This is great content. gaming hardware

That'sthe rationale

That'sthe rationale advertising and marketing for you to proper studying before writing. Also, it is attainable to write down superior writing because of this. college dissertation

veer

I would like the information posts, Help make appreciated, I might favor far more details applying this, considering it is very desirable., Bless an individual made for creating. help with research paper

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.