Archive for July 2011

Tomcat 5 not reloading changes in JSP


Part of the beauty of JSP development is the easy of trying out the change. All you have to do is edit the JSP file, save it and reload the page. Yesterday I got caught by surprise by not being able to do exactly that.

I saw some strange behaviour in an EL expression used JSP tag. As it was nothing ATG specific, I decided to try it out in plain old Tomcat rather than full ATG application. So I located the instance of Tomcat 5.5 (I always have couple of Tomcats lying around) and being lazy, I decided to inject the change into out-of the box jsp-examples Web application that comes with it.

I picked a victim JSP to be modified (jsp2/el/basic-comparison.jsp), made my change, reloaded page – nothing. I must have forgotten to save the file, did it again – nothing. Weird. Maybe browser caching. Cmd-Shift-R – nothing. Tried different browser – it showed unchanged file as before. Definitely not a browser issue.

The most logical explanation would be that I am editing different file than reloading: so I verified that the JSP file I edited is indeed under WebApps, that correct version of Tomcat was started. It was. There was no context redirection in place but to be sure, I unzipped pristine copy of (I have couple of those around as well), copied the JSP there, started it – same thing.

Really weird.

Few more experiments showed that no change to any JSP page under jsp-examples was visible. Removing JSP page caused 404 error as expected, but as soon as the page was there, it reappeared in original pristine version.

At this point, I started to suspect there is something fishy with the jsp-examples application itself. And it was. Brief check of the web.xml showed that it is quite long (24K) and that it contains declaration:




and suddenly it all made sense.

As long as the JSP file was present (Tomcat checks), it’s content was completely ignored and the request for /jsp2/el/basic-comparisons.jsp was served by COMPILED class /webapps/jsp-examples/WEB-INF/classes/org/apache/jsp/jsp2/el/basic_002dcomparisons_jsp.class – which of course did not contain any of the JSP file changes. When I removed file, Tomcat reported 404 a- the check for file existence comes before check for URL mapping apparently.

Moral of the story: being lazy causes one has to do more work but often learns something new. Had I created fresh new WebApp, none of these mappings were present and I would never realized what is Tomcat 5 doing behind the scenes.

Btw, in Tomcat 6 the mappings are gone and everything behaves as expected.

Although this is not technically a bug – but a feature – it is unfortunate that this optimization is used exactly in one application that can be used by newbie developer learning JSP for experimentation and not seeing it’s change can confuse the hell out of them. Especially when googling the issue will very likely sending him/her in completely wrong direction – suggesting reconfiguring Jasper, playing with valves and internals of Tomcat configuration.

Google+ is superset of both Facebook and Twitter


It may be too early to express opinions about something so new as Google+, but in the short few days I was playing with it, I started to like it a lot. Many bloggers consider it to be a Facebook killer – and it (unlike two previous Google attempts on social networking) eventually may become that. Conceptually, however  it is much closer to Twitter than Facebook.

The biggest difference is that in G+ there is no peer relation – “friendship” that needs to be confirmed by both parties. Both ends are disconnected in Google+ – set of people whose updates you see in your stream and set of people that see your updates is not the same and can be in extreme case disjunct.

In G+, like in Twitter, everybody chooses set of people whose updates you want to see – you “follow” people. This following does not require any approval on their end. Unlike Twitter, you can easily organize the people you follow into groups (circles) and with single click limit the news stream only to members of this group (where one person can be in many groups). It is like having multiple Twitter accounts, each with different set of people followed and switching identities.

On broadcasting side, you can select the target audience for each post by addressing the message to be visible publicly (Twitter default), by any member of your circles, your extended circles (kind of “friends of friends”), one or several named circles, or even named set of people from your circles. Whether your message will actually appear in their message stream depends on whether the addressee did add you into their circles. Twitter does allow you only public updates. (Yes, ok, there are “protected tweets” by who uses them ?). Facebook allows you updates only for all your friends or single FB group.

For example, I have group named Following with members like Andy Ihnatko, Leo Laporte, Leo Babauta and other internet celebrities. Clicking on the circle will show me all public updates from these people, but it would contain none of the posts made e.g. by Andy for his circles – of which I am not member of. Similarly, should I post an update for the “Following” circle, Andy would never see it in his news stream (despite of that I do have him in my circles) as I am not member of his circles. This way Google created incredibly flexible framework that can deliver any mode of communication available from Twitter and Facebook:

1) Twitter following: see above
2) Facebook friends: both parties add the other to circles
3) Facebook groups: named circle (plus possibility of multiple groups and administration that does not suck)
4) Friends of friends: extended circles
5) direct message to person (in your circles): update with single person recipient

What G+ does not have (yet) are applications/games and public developer API. I am pretty sure that promised availability of the later will cause the explosion in the first. It will be very interesting to see the impact of this new, much more flexible “trust model” on the kinds of applications available.