How Tomcat Works
First of all, this is the only book I know of that explains how the complete system works. You can find good documentation on how to use this most popular servlet container on the Tomcat project's Web site, but little is said about how it works. If you want to join this open source project, good luck. You should consider yourself lucky (or very brilliant) if you can understand how the system works in less than 3 months by browsing through its millions of lines of code.
However, why I find this book appealing is because of the approach the authors take in analyzing it: build Tomcat from scratch, line of code by line of code, module by module. Miraculously, in doing so they never fail to make sure their readers can follow the technical discussions. In their hands, Tomcat looks easy that even beginners of Java can understand. There are many complex technologies used in Tomcat, and they are all explained well.
The book starts off by building a dummy Web server that can do no more than sending a static HTML page. The web server is simple and consists of only three classes. The backbone of this application is the java.net.Socket class, and the authors take their time explaining this class at the beginning of the chapter. Basically, this is how the application in this chapter works: for each HTTP request, open a socket connection to the client, read the content of the static file, and send the file to the browser. As simple as that.
Chapter 2 builds on the application in Chapter 1. In this chapter, the web server gets some intelligence. It is now able to invoke a basic servlet by calling the servlet's service method. However, more complex servlets are beyond this simple servlet container, mainly because the container passes a null ServletRequest and a null ServletResponse objects to the service method. Before the authors start coding, they explain the javax.servlet package in general so that those new to servlet programming can understand this chapter.
Chapter 3 explains how to create ServletRequest and ServletResponse objects so that the servlet container in Chapter 2 can do more. The excitement comes in Chapter 4 when the authors explain how to pool ServletRequest and ServletResponse objects to beef up performance. This topic is not only relevant to Tomcat, but also Java programming in general. Object instantiation is expensive, and one way to avoid it is by reusing objects. However, you must be careful when your application will be used by many clients, as you must then think about thread safety. Chapter 4 elegantly explains how Tomcat developers solve this problem, as well as teach you a general solution for object pooling. Interestingly, a servlet is always represented by a single instance, and the same instance services all incoming requests.
The authors are also patient in explaining everything step by step, until the last chapters where they tackle more difficult problems such as Digester, JMX, class loaders and session management.
Not only will you be good at configuring Tomcat after you are finished reading this, you will also be able to tell straight away what's going on whenever your Tomcat installation throws up some error message. In addition, if you are really serious about Tomcat, you can start thinking of writing your own modules or extending the existing ones. For example, as the authors have demonstrated, you can extend Tomcat's application loader to automatically reload a Struts application when the struts-config.xml is modified, making the application development process quicker.
This book is also great in answering many questions that seasoned servlet/JSP programmers might have long been pondering. For example, this book discusses the difference between an OutputStream and a PrintWriter, and why you can only use one of them rather than both. It also tells you why you cannot write to the request parameters or headers.
Now, as much as I liked it, this book is not perfect. The first noticeable flaw is that there are quite a number of disturbing spelling mistakes. Also, the index could have been better, not to mention a cover that is plain and uninspiring. However, I have to admit I am very happy with this book and will recommend it to any Java programmer.
You can purchase How Tomcat Works from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
404 File Not Found= 6) was not found.
The requested URL (books/04/11/12/2042249.shtml?tid=192&tid=108&tid
If you feel like it, mail the url, and where ya came from to pater@slashdot.org.
I came from a link on the front page. I thought I was supposed to click on the hyperlink, but I must have been mistaken.
What's Tomcat?
~Ilyanep
To get message, take amount of carrier pigeons at each stage mod 2. Then decode binary.
Please do the research for us before posting?
What is Tomcat? Something used to make Java Servlets?
From java.Sun.com
"The Java Servlet specification was created under the Java Community Process to provide full public participation in the definition and development."
So what does that mean practically speaking?
Simon's Rock College
or do java apps take up a huge amount of system resources? Everytime I launch one, my system crawls.
But I thought we weren't supposed to judge the book by it's cover?
I've been running Windows XP since beta2, and it really kicks ass. I don't have to recompile my kernel when I want to install an ethernet card, it automatically detects it and installs the drivers no matter who the manufacturer is. Dual monitors? No chore with windows, get two video cards, two monitors and it's set up! I don't need to edit config files with editors that are 20 years old, and show it. Intellimouse custom buttons? Piece of cake, with my Intellimouse software. You want to run games? Great! Choose from an array of tens of thousands of games that run great under DirectX and the NT subsystem. Stability got you down? Not in this version, I have had uptimes of over a month (and then the damn power goes out). Good internet browser? No need for Kommunist shit, you've got the great Internet Explorer 6 a click away. Doing some development? Nothing but the best for Windows users, choose from a suite of Visual Studio products that suits your needs, with one killer IDE. Or, pick up a beta edition of Visual Studio.NET if you have 200 megs of RAM to spare! You Linux faggots can keep rooting for your piece of shit operating system that Windows 3.1 tops in terms of compatibility, all the while hindering your experience for something else you could be doing, while I use the operating system of choice (or by default) for over 200 million others in the world. Anti-Microsoft zealots piss and moan all you want, but your queer little OS won't be the reigning desktop champion anytime soon.
...that some buisness need to read. The local school system here runs Blackboard which seems to use Apache Tomcat, and it really has problems, both with sessions and general speed. Perhaps some bigger corporations shoudl go back-to-basics with nice books like these.
WASTE - The Secure P2P
I installed it once and my symantec went batshit crazy on all of its DLLs. It reported it as a ton of spyware. EZULA, coolshredder, you name it. WTF is Slashdot thinking????
What Tomcat Is
Get it form Amamzon.com
How Tomcat Works
From TFA, it seems tha book is quite basic. Would be great if it would actually discuss "how tomcat works, internally", something like a really advanced course. The material in book can be found in tutorials and stuff, but its slightly more difficult to figure out for the first time that you can "precompile" the jsp pages so the site is fast right from the very first hit.
Is is funny or ironic that the authors web page runs on php? http://www.brainysoftware.com/
I have been paid to build MS apps for years now, but I have "watched" Java from a distance and have to say that if I started a business of my own, all applications would be written in Java/JSP. I was one of the first to attempt to build Tomcat on a Windows system and after many disasters came to love it. The inner workings of Tomcat often baffled me and now I am gonna have a book! Sadly nothing I learn will translate to my current job, but it'll be damn fun.
--I smoked my sig.
What? If I had a servlet, what would I do with it?
Simon's Rock College
Have you got Tomcat development experience? Automating Open Exchange? Want a job? Reply to my journal.
--
make install -not war
Anyone know how this books compares to the O'Reilly book, " Tomcat: The Definitive Guide"? Also, it might be helpfull for people to know what a Servlet and JSP is before spouting out terms.
/.land using Tomcat for their production site? Also, any care to give any recomendations for an eclipse plug-in?
About the only thing common between an Applet and a Servlet is that both are writen in Java. Anyone out in
Not to disagree with the claims in the first paragraph of the article, I can't imagine how this could possibly be useful to me. Maybe he should have said it would be "incredibly useful" for somebody actually doing web-server-side Java.
To have known how Tomcat works this past weekend when I was setting it up for a client. WHat a nightmare. Reminds me TOO MUCH of setting up Chilisoft ASP for Apache. Sure its a good idea, but I think its implemented poorly and from an administrators point of view, I found it hard to know where to start. The documentation for setting up Tomcat needs to assume that the administrator doesn't have any knowledge (or little) of Java.
basketball+fantasy=yay
I actually think that cover is elegant.
nice. But, I want "How Struts Works." Debuging struts applications is one of the closest things to hell that I've experienced in some time.
Ishmael
Click on the "Tomcat project's Web site" link in the second sentence of the "rest of the review". We can't click for you. But be advised, if you have to ask these lazy questions, you probably can't program a Tomcat app, no matter what it does.
--
make install -not war
Netcraft says they also have FrontPage(!), SSL, Apache, and Linux(no !). Must be a standard hosting package from Interland.
Simon's Rock College
Oh yeah?
And maybe someone just wants to make money on their amazon referral?
It is available from BN for $10 less.
I passed the Turing test.
but what is the deal with you Tomcat fanatics? I've been sitting here at my freelance gig in front of a IBM X series dual processor server with four gigs of RAM for about 2 months now while it attempts to serve up my 'hello world' jsp page. 2 months. At home, on my C64 w/ 64k of RAM running Apache 0.0.1 , which by all standards should be a lot slower than Tomcat, the same operation would take about 3 seconds, if that.
In addition, while I am waiting, top will not work. And everything else has ground to a halt. Even bash is straining to keep up as I type this. I won't bore you with the laundry list of other problems that I've encountered while working on various Tomcat installations, but suffice it to say there have been many, not the least of which is I've never seen a Tomcat that has run faster than its Apache counterpart, despite the thousands of lines of code stolen from SCO and Sun. My Tandy 102 with 32k of ram and MS BASIC web server impelemented by my three year old runs faster th an this. From a productivity standpoint, I don't get how people can claim that Tomcat is anything more than a steaming shitpile.
Java addicts, flame me if you'd like, but I'd rather hear some intelligent reasons why anyone would choose to use JSP. Hell, I could hand deliver web pages halfway around the world faster than this.
From this follows that object pools are counterproductive for performance (unless, of course, if resources are associated with them, like Database connections, open sockets, etc.).
I heard that quite a few app servers (including JBoss) started to refactor to get rid of object pools, but I don't have a link to back this up.
Under capitalism man exploits man. Under communism it's the other way around.
You should consider yourself lucky (or very brilliant) if you can understand how the system works in less than 3 months by browsing through its millions of lines of code.
If that's true, it sounds like it is bloated and not very well designed.
I'm posting this in IE - which I had to open just to read this writeup. Slashdot's HTML is flaky and when viewed in Mozilla Firefox, it blows out the table to 3x screen width (1024) and puts black text on black background.
Please fix your code. A lot of us use Mozilla around here!
Thank you,
Brian
--
http://www.assortedinternet.com/
This may be off subject, but is somewhat related. The main computer in my house is a dual-boot P4. The disk has three partitions, NTFS, Reiser, and FAT. It is VERY nice to have a single location for my web server application (located on the FAT).
When I boot XP, Tomacat run my web app. When I boot Linux, I can run the EXACT SAME web application.
Granted, I could probably do the same with some other environmnets (which I choose not to mess with).
Keep in mind this is a family web site accessed mainly by family member. (Christmas lists, little league info, etc. etc.).
I'd really like to see some docs (a book, notes on the web, etc.) for admins.
I'm not a java developer, I don't want to be a Java developer, but I have users who do.
All of the Tomcat docs I've seen are written from the developer perspective. I need to be able to set up and maintain a development environment for students where they can work, and that doesn't crash the tomcat server every time somebody makes a coding error. But I have no desire to learn Java, only enough Tomcat to keep it running.
Ignorance killed the cat. Curiosity was framed.
You can read some sample chapters here. Just use your favorite archiving application and acrobat reader(neither included).
My boss came into my office a few minutes ago, saw this book on my desk, and asked if I had seen the review on Slashdot. I laughed a bit and said I had. I read this book many months ago, and told my boss about it.
"How Tomcat Works" is a potentially good idea, done badly.
The writing is awful. Not just inelegant, but frequently so bad that it gets in the way of the ideas being presented. Spelling, typos, grammar problems, convoluted sentences, miswordings that invert the meaning of a sentence entirely: this book has all that, and more. A fourth grade teacher with a red pen would have made this a much better book.
A book on "Tomcat Internals" is a wonderful idea; Tomcat's a somewhat complicated beast. But the approach that this book takes... it just didn't work for me. It's possible that I simply couldn't get past the bad writing. Or it may simply be that it doesn't meet my needs. I'm familiar enough with Tomcat that I don't need it explained in tiny little baby steps. What I do need, when I'm up to my ankles in Tomcat internals and trying to solve a particular problem and get on with my life, is a clean, well organized book that will quickly get me oriented, refresh my memory on the relevant bits of Tomcat's architecture, and point me to the solution to my problem. This book fails to do that.
The production values in this book leave a lot to be desired. There aren't enough diagrams, and, at least in my edition, the few that do appear are printed at very low resolution. The index is a joke. (Hint for the authors: a quick indexing script doesn't always make a useful index, okay? Second hint: hyphens denoting sequential pages are cool.)
I've learned a lot about Tomcat since reading this book... mostly by wading through the source code. After a quick initial read-through, "How Tomcat Works" has stayed on my bookshelf, untouched, for at least five or six months. This book will join "Apache Server Commentary" in the pile of books that seemed like a really good idea, but in the end, were much less helpful than I had hoped.
If you just need a book on installing or using Tomcat, or writing Java servlets in general, there are many better books. If you need a book on Tomcat internals, you probably need a better book than this one.
"This doesn't necessarily knock down existing frameworks like Ruby on Rails, which looks pretty sweet, or anything with frameworks."
http://www.beta4.com/seaside2/
especially in an environment where the guy in charge of the jboss deployment couldn't make it run from an exploded WAR file. so every change meant a wait for the compile, zip up into a 1.5meg WAR file, copy it to deployment directory. Jboss then unexpands it and starts deployment.
:)
you then go through the whole login thing only to find out you screwed the configuration file.
java/html/struts single handedly killed my love of coding within a year. coded since i was 11, now 33. hardly touch code now even for fun.
php is much better adapted for the web. php 5 is getting 'closer' to java (integration as well as the language) so if i was to do anything that required a middleware layer now i'd do the front in PHP and use java for the middleware. and get somebody else to do that, screw EJBs
anyway, so they're (BB inc's) idiotic set up of Tomcat, your stuck with it. A better idea is to get them to switch to Moodle, it's every bit as good as BB, faster, and runs on straight LMAP, no need for stinky ol'Tomcat (nor MS SQL & IIS, ak-pffft!).
Comment removed based on user account deletion
anyway, so they're (BB inc's) idiotic set up of Tomcat, your stuck with it.
What are you trying to change that you haven't been able to? I've changed a few of BB's tomcat settings.
no need for stinky ol'Tomcat (nor MS SQL & IIS, ak-pffft!)
Don't need MSSQL or IIS for BB either.
One of the biggest problems so far has been finding good info on the process of integrating Tomcat/mod_jk with Apache under Win32.
Good luck using any official Guides for the task.
Check...
http://www.devside.net/web/server/windows/Tomcat
http://www.devside.net/web/server/windows/mod-jk
It is useful for not only those using Tomcat or those working with servlets/JSP/J2EE ...
As a J2EE programmer, I find the reviewer's statement to be a bit misleading.
Tomcat is not a J2EE server. The J2EE specification deals with Web Components (Servlets, JSPs) and EJBs (various EJB types and related services). Tomcat only satisfies part of the the full J2EE specification by serving Servlets and JSPs. Therefore, Tomcat is only a Web Container.
JBoss is an example of a J2EE compliant app server.
I'll bet this is a troll. No specific details, could do a s/Tomcat/whatever/ and get the same review, the classic calling cards of a book review troll. You make the call...
distributed, load balanced, objects -- it will load balance across a cluster as well as on SMP machines, which are very common in SUN installations. A servlet must be serializable so that at any point the container can externalize it and resume it on another node.
Like strong Java OOD/OOP*. Like JDBC for database access that beats all other database abstraction layers I have seen. What about a lot of mature libraries and frameworks that make MVC2** application much easier. Ability to reuse your code in dekstop applications. And many more.
* Object Oriented Design/Programming
** Model-View-Controller 2 app architecture
--Coder
on server side. I code web-apps for a living in java, and it beats anything maybe except apache plugins coded in C in performance. The myth that java is slow comes from poorly coded desktop GUI apps using Swing toolkit. That doesn't mean language itself is slow. On server side, where there's no GUI, it's screaming fast. Oh, and who cares about startup, you only need to start your server once. And now that IBM has made a decent GUI toolkit for java (SWT), it is becoming a decent language to write desktop apps too. Check out Azureus bittorrent client. I don't think you will complain it is slow. I had SWT plain text editor start up faster than gedit.
--Coder
I just completed an evaluation of the leading servlet engines for my employer, including the fabled Resin, and Tomcat 5 came out ahead in nearly every respect. It even had a 16% - 20% performance boost over Resin. We couldn't believe it ourselves... If you weren't considering Tomcat because of outdated opinions, it's time to take a second look.
By comparisson Tomcat is one of the best and quickest servers to run J2EE, servlets and JSP (it is also the best static content server around, Apache you know).
:|
I have used many other java application servers and they don't really come close. WebLogic dev environment and stability made me appreciate a root canal. WebSphere taught me patience while waiting for the debugger to start (if it doesn't crash while starting); not to mention the debugger can easily use up 1GB of ram while running. iPlanet, well I won't even go into that, I'd rather forget those 6 months I had to write code for it and it's bastard brother Kiva.
Tomcat is relatively lightweight, you can use Eclipse to develop and deploy to it. But most important, the code executed on it is as good as the writer of the code and too often people writing apps for Tomcat should have just stuck with thier non-CS background and found an appropriate job
On a side note, J2EE is a big hype, it's slow, cumbersome and overly complicated. You can do almost enything you want with a servlet or JSP page (and people should always try to keep as much of the content static as possible to take advantage of caches and reduce pointless execution cycles). Marshalling code in many implementations adds too much overhead to justify any benefits you may get from distribution, but your mileage may vary.
Tomcat is free, people can just download it (http://www.apache.org) and try it out, the online docs and FAQs are pretty good, then once you have it running and you like it, buy some good books on it.
recommended for all web developers out there
I was under the same impression when I had a look at struts.
I also tried a project with a struts-like PHP framework and it was awkward. Can you recommend any alternatives to struts?
it scares me that I DO judge a book by its cover, but I do. all of us do.
For instance, I judge cereals by the cover, a whole new box. Now bearing in mind a box of cereals fills that quasi-intimate moment where I am still half awake, and I lovingly spoon it into my mou... oh, sorry.
You see, books have to be appealing to us, technical books have to say, read my witty and easy going words, and you will be amused and infused!
In a semi-related issue. In the new world of e-publishing, we see the internet is 99% utterly useless.
Now real-world publishing on demand is sparking a torrent of even worse writing that is, shockingly, taking itself seriously.
I am quite happy the way many OS developers have written authorative books on thier works, but in the future some enterprising scum might cloud the market place with bound copies of man pages and other scamful publishing.
#hostfile 0.0.0.0 primidi.com 0.0.0.0 www.primidi.com 0.0.0.0 radio.weblogs.com
I had similar experiences with Tomcat. However, Jetty has worked great for me.
Last time I got IIS and Tomcat talking was after I abandoned the jk2 and went back to the jk connector.
c at_iis6_resources.html
There are some additional steps including permission setting to get IIS to use the redirector.
More info here: http://www.rit.edu/~ack5504/tomcat-iis6-howto/tom
--- I wish I could hear the soundtrack to my life. That way I'd know when to duck.
one idiots opinion
Nice try, asshole.