<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>byte bohemian &#187; Webserver</title>
	<atom:link href="http://nicl.net/category/technology/webserver/feed/" rel="self" type="application/rss+xml" />
	<link>http://nicl.net</link>
	<description></description>
	<lastBuildDate>Sat, 15 May 2010 20:51:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tomcat 6.x &#8230; doing it the right way!</title>
		<link>http://nicl.net/2008/07/tomcat-6x-doing-it-the-right-way/</link>
		<comments>http://nicl.net/2008/07/tomcat-6x-doing-it-the-right-way/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 14:24:10 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://nicl.net/2008/07/19/tomcat-6x-doing-it-the-right-way/</guid>
		<description><![CDATA[Some days ago I posted a blog entry about using Glassfish v2 EJBs with the Tomcat. At this moment I thought that I solved the problems, but last week we were setting our testing evironment on a Debian Linux box and the problems reoccured.
At this moment I thought of a glitch in the server setup [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago I posted a blog entry about using Glassfish v2 EJBs with the Tomcat. At this moment I thought that I solved the problems, but last week we were setting our testing evironment on a Debian Linux box and the problems reoccured.</p>
<p>At this moment I thought of a glitch in the server setup but some nagging hours later I realized that my so clever solution was a dirty hack. Which works in a Microsoft Windows environment, but refuses to work on in a Linux environment.<br />
Ok,  I have to confess, that I wasn't really happy with my first solution in the end. Renaming JARs to provide the correct order of class loading always leaves a bad taste. But at that moment I was happy, no other solution was in sight and I had absolutly no time.</p>
<p><span id="more-12"></span></p>
<p>Some days ago I posted a blog entry about using Glassfish v2 EJBs with the Tomcat. At this moment I thought that I solved the problems, but last week we were setting our testing evironment on a Debian Linux box and the problems reoccured.</p>
<p>At this moment I thought of a glitch in the server setup but some nagging hours later I realized that my so clever solution was a dirty hack. Which works in a Microsoft Windows environment, but refuses to work on in a Linux environment.<br />
Ok,  I have to confess, that I wasn't really happy with my first solution in the end. Renaming JARs to provide the correct order of class loading always leaves a bad taste. But at that moment I was happy, no other solution was in sight and I had absolutly no time.</p>
<p>Enough with apologies at this moment, we were late setting up the testing environment too and there was work to do. So I decided to take a different approach and tried to find out some more about the classloading of Tomcat 6. One of my primary questions was: "Why did the Tomcat 6 developers removed the different classloading directories?"</p>
<p>The answer suprised me more, than I expected! After using Google for a while, trying to find out more about the differences in classloading between Tomcat 5.5 and Tomcat 6, I stumbled across a small file: The <code>catalina.properties</code>. This file revealed the secrets of the differnces in classloading between these two Tomcat version. The simple and quite beautyful answer is: There aren't any real differences. The distributions have different default settings, but the classloading mechanism is quite the same. At this point I am getting some more cautious than the last time. The two mechanisms are the same, as far I can judge it from my appication developer/deployer point of view <img src='http://nicl.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>So what is this <code>catalina.properties</code> all about? The <code>catalina.properties</code> - as I understand it - controls some major classloading and security issues while bootstrapping the Tomcat web container. It has three (for my problem) relevant entries:</p>
<pre>
common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
[...]
server.loader=
[...]
shared.loader=
</pre>
<p>These three entries are controlling three classloader in Tomcats classloader hierachy. The server classloader, the common classloader and the shared classloader. The server classloader is resopnsible for loading the libraries of the tomcat server. It is not set in the Tomcat 6 default distribution and will default to the common classloader which will load the server related classes now. The common classloader is responsible for loading classes common to the tomcat installation. Which are in the Tomcat 6 the server classes as well as addiontional classes like the JavaMail API oder some database driver classes (if you are configuring them with JNDI i.e.). The last classloader is the shared classloader which may load classes which may be shared between different web applications. This is the place where the Amis <a href="http://technology.amis.nl/blog/?p=1368">blog entry</a> suggests the glassfish JARs to be placed, but which I hadn't found in the Tomcat 6 distribution.</p>
<p>After I discovered the secrets of the <code>catalina.properties</code> it took me half an hour to create a <code>shared/lib</code> directory in my <code>TOMCAT_BASE</code> and adapting the <code>catalina.properties</code> file. Now I had the proper place for my Glassfish files and it worked nearly instantly. Good to know that you can make the integration of Glassfish EJB and the Tomcat 6 in a proper way and also good to know about this tiny little classloading tricks of the Tomcat 6 <img src='http://nicl.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>As you say in german: "Kaum macht man es richtig, dann geht's!" (If you starting to do it the right way it works)</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2008/07/tomcat-6x-doing-it-the-right-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An ETag is not about aliens</title>
		<link>http://nicl.net/2008/05/an-etag-is-not-about-aliens/</link>
		<comments>http://nicl.net/2008/05/an-etag-is-not-about-aliens/#comments</comments>
		<pubDate>Sun, 18 May 2008 18:27:26 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Servlet]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://nicl.net/2008/05/18/an-etag-is-not-about-aliens/</guid>
		<description><![CDATA[So what is this ETag thing. I am working since 1998 in the web business but I came across ETags some weeks ago when some of my customers starting to worry about their perfomace. Don't get me wrong, out apllication worked - as always - fine, but some pages where slower as the equivalent pages [...]]]></description>
			<content:encoded><![CDATA[<p>So what is this ETag thing. I am working since 1998 in the web business but I came across ETags some weeks ago when some of my customers starting to worry about their perfomace. Don't get me wrong, out apllication worked - as always - fine, but some pages where slower as the equivalent pages at the websites of their competitors. We checked our monitoring data, it's always good to know of the webstite performed on yesterday, yesterweek or yestermonth, but were unable to find some issues. So we went from the server to the protocol and the client and checked some static and dynamic pages. As I was taking a closer look at a static webpage I stumbled over a HTTP header which I didn't know: ETag.<br />
<span id="more-5"></span></p>
<p>So well, my first blog post with some contentent. I am quite excited and somewhat terrified, I really hope my english will be good enough.</p>
<p>
<p>So what is this ETag thing. I am working since 1998 in the web business but I came across ETags some weeks ago when some of my customers starting to worry about their perfomace. Don't get me wrong, out apllication worked - as always - fine, but some pages where slower as the equivalent pages at the websites of their competitors. We checked our monitoring data, it's always good to know of the webstite performed on yesterday, yesterweek or yestermonth, but were unable to find some issues. So we went from the server to the protocol and the client and checked some static and dynamic pages. As I was taking a closer look at a static webpage I stumbled over a HTTP header which I didn't know: ETag.</p>
<p>
<p>What is this ETag thingy? Why do only static pages have it? Okay to get this clear, I have to reveal some secrets about our customers setup. It runs on an Apache webserver who delegates the dynamic webpages to a Tomcat servlet container. They dynamic content will be generated there by some servlets and JSP. But this is also the solution. The static page was deliviered by the Apache HTTPD and the server adds the ETag header to all files.</p>
<p>
<p>So again what is this ETag thingy? What is it good for? Something I learned some years ago: It's always a good Idea to go to the source. In this case its the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19">RFC 2616</a> in Section 14.19 the ETag HTTP header field is defined. But nowadays it's quite okay if you check Wikipedia first and at least a Wikipedia you will get a link to the RFC.</p>
<p>
<p>I confess it took a little while for me to understand what the ETag is good for. The web server may create an entity tag for the requested entity. This tag acts like some kind of content identifier or a kind of version number of the content. The Browser can use this information at a later time, when the entity (URL) is requested again send the ETag value in the "<span style=" ;font-family:Helvetica;font-size:12px;">If-Match" or more likely the "If-None-Match" header field. If the browser does so, the server may evaluate the header and send a simple 304 (Not Modified) response instead of a 200 (OK) response and the data of the entity. The whole thing works basically equally to the "Last-Modified" and "If-Modified-Since" or "If-Unmodified-Since" mechanism. So why to we need this redundancy?</span></p>
<p>
<p>I am not that deep into the specification process of the HTTP protocol, but I am working a while with distrubuted web applications. Sometimes you simply need to mess around with the latest modification date of a file to get some rsync-ing right or something like that. In general the bad news is: The last modified date is not that reliable if you want to determine if a file is still the same. So this ETag thingy seems to be a good solution to this.</p>
<p>
<p>In real life nothing is this easy. The Apache web server calculates the ETag value out of the INode of the file, the last modified date and the size of the file. This is quite awkward if you have more than one HTTPD instance delivering the same file (i.e. if you use DNS round robin load balancing). It would be a small miracle if the file gets an INode with the same id on the different instances. So the ETag mechanism may get some kind of useless, so that Yahoo! recommends in their <a href="http://developer.yahoo.com/performance/rules.html">Best Practices for Speeding Up Your Web Site</a> to deactivate the mechanism. The logic behind this recommendation is: A useless check done is a waste of time. I am not totally lucky with this but Yahoo! has some kind of point with it.</p>
<p>
<p>Luckily you can configure the ETag creation in the Apache web server with the <a href="http://httpd.apache.org/docs/2.2/mod/core.html#fileetag">FileETag</a> directive. So may use only the modification time (MTime) and the file size (Size) for the ETag creation. This should work out quite well and if you can keep the last modified date in sync between the your web server instances the mechanism should work properly.</p>
<p>
<p>Okay I hope someone else reads this and may find it useful. At the moment I am investigating some ETag and last modified header issues with servlets and JSP. I guess I will try to blog about it soon ...</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2008/05/an-etag-is-not-about-aliens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
