Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Wednesday, July 07, 2004

Updated Tapestry In Action Examples

I just spent an hour or two updating the Tapestry In Action examples. This new source code distribution will be available from Manning's web site, in the meantime you can get it here (3.3 MB).

Changes:

  • Now works with and requires, Tomcat 5 (tested with 5.0.25).
  • examples.war renamed to tiaexamples.war, to not conflict with Tomcat's built-in examples.
  • No longer changes Tomcat's server.xml
  • Now includes the Tapestry 3.0 libraries and dependencies ... no seperate download needed.

Why include the libraries? Because it turns out that the exect version of the Tapestry framework is critical to getting the WAR to deploy. Initially I couldn't get tiaexamples.war to deploy and it took me forever to track it down; there's a reference to the Tapestry JAR in its web.xml:

  <taglib>
  	<taglib-uri>http://jakarta.apache.org/tapestry/tld/tapestry_1_0.tld</taglib-uri>
  	<taglib-location>/WEB-INF/lib/tapestry-3.0.jar</taglib-location>
  </taglib>
If that JAR doesn't exist (say because you tried to deploy using 3.0-rc-1) then the WAR just doesn't deploy. You have to dig through the Tomcat logs for a while before you find the problem. The best solution was to ensure that the version matches up by including all the libraries and dependencies (getting the dependencies being every newbies #1 issue). Because this distribution isn't served off of apache.org or a mirror, including the dependencies is completely legitimate.

6 comments:

Matt Raible said...

Just curious - why do you require Tomcat 5?

James said...

You should be able to remove this dependency by packaging the .tld in the META-INF directory of the tapestry jar, yes?

Howard said...

Not that I'm aware of. Point me at some documentation; the official docs for JSPs are very, very weak on this subject. Most people export the .tld file and store it directly in WEB-INF. To me, its another "smoking room" decision where nobody bothered to work out in the specification something that actually worked.

The final Tapestry 3.0 release was compiled against the 2.3 JSP apis which did not appear to be compatible with Tomcat 4. I got class loading errors related to a changed method signature.

Since it works under Tomcat 5 and virtually everyone is interested in Tomcat 5, I changed the Ant build scripts to just support Tomcat 5.

James said...

This article gives a little detail: http://www.onjava.com/pub/a/onjava/2001/10/10/jsp.html?page=2

As long as the .tld contains the expected URI and is packaged in the META-INF directory, any JSP 1.2 or later container will find it automatically.

Goffredo said...

Hi,
Just bought the book which I liked a lot. Installed
Tapesty 3.0 which works well with examples. But the
Tapestry In Action examples are dead in the water
(well almost). The hangman example works, plus one
other, the rest ... are no go. I am using Linux 9,
Tomcat 5.0.25 (in fact I tried a number of 5.0.x
Tomcats to no avail), and FireFox browser. I could
try it on NT/XP etc but ... my feeling is there is
something wrong that needs fixing so that the examples
(from the new source code installation) are not dependent upon a too precise version of Tomcat, and
can run on Linux with the standard Java packages out
of the box.

ramon said...

Could you send me a copy of the source code in Tapestry in Action, i couldn't download from the web site,thanks a lot