Note: This fix is if the issues persist in Ch21+ examples. Ch20 has additional issues that prevent the sample code from working correctly.
Not to revive a dead thread, but this book is still the best resource for self-learning and I had an immense amount of trouble getting the JNDI datasource to work. After trying countless fixed that didn't work, I learned that the nameNotFound exception when working in eclipse was due to the fact that eclipse makes its own copy of the Tomcat configuration. Entering the JNDI datasource definition inside the context file of Tomcat isn't seen when running from within eclipse. To make the datasource visible all you need to do is open the context.xml from WITHIN eclipse and paste in the datasource as seen here:
http://www.codejava.net/servers/tomc...ling-in-tomcat
After literally hours upon hours of troubleshooting, this 5 second fix may work for you too!