Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Context Reloading in Tomcat 5.5.7

Today I started using Tomcat 5.5.7 instead of 5.0.28. It was fairly easy to install on my PowerBook - I just had to add the xerces and jmx JARs from the compat package to get things working. The one thing I noticed that's different from Tomcat 5.0.28 is that when I deploy any file, it reloads the context. This can be a pain when I'm just copying JSPs into the webapps directory. I'm willing to admit it could be a problem with my "maven deploy" goal, but since this didn't happen on 5.0.28, I suspect it's the newer version of Tomcat. On 5.0.28, the context was only auto-reloaded when I updated files in the classpath.

The main reason this was frustrating is because we look up a bunch of data from a web service on app startup. The API we're talking to is nice and slow and it takes almost 50 seconds to start our application. Rather than go back to the older version of Tomcat, I wrote some code to serialize all the ServletContext variables to disk, and then check for that file on startup. If the file exists, it deserializes it and puts all the objects back in the ServletContext. Works pretty good and certainly speeds up my development environment. After all this, I'll probably downgrade to 5.0.28. Auto-reloading when classpath files change seems like a better way to go.

Posted in Java at Feb 10 2005, 05:47:21 PM MST 5 Comments
Comments:

Have you looked in the file CATALINA_HOME/conf/context.xml? Im not sure if it will help your specific problem, but its handy to know about anyway. In it you can define what resources are watched and will trigger a reload of the context.

Posted by Daniel Campagnoli on February 11, 2005 at 01:34 AM MST #

Also, be aware that if you use Struts and its Plugin framework, your plugin destroy() method will not be called due to a bug in that version of Tomcat (fixed in CVS). I only mention it in case you also did any resource cleanup during context unloading.

Posted by Kev Palfreyman on February 11, 2005 at 10:21 AM MST #

Sorry if this might sound stupid :), but wasn't tomcat 5.5.x series developed for JDK1.5, and requires that runtime to run? This is in the readme. AFAIK there's still not MacOSX release of JDK1.5 , or am I missing something?

Posted by Ahmed Mohombe on February 11, 2005 at 10:45 AM MST #

5.5 can be set up to work with 1.4--Matt is mentioning the 'compat'-ibility package in his post. Matt, did you try to set reloadable="false" in the <Context> element for your app? My 5.5 upgrade adventure (on W2k adv. server) was fairly painless also, although I'm noticing my explorer windows are prone to crashing, esp. when I'm editing server.xml in notepad... Also, it appears that you can't have a root context defined to the folder you want, it HAS to be called ROOT... e.g. <Context path="" docBase="myAppFolder"> does not work. A blank page is all that comes back. Renaming the folder to ROOT made everything okay.

Posted by Patrick Dumontel on February 11, 2005 at 01:47 PM MST #

Hi Matt, Check out the Maven Tomcat plugin (http://www.codeczar.com/products/maven-tomcat-plugin/). If you set the reloadable attribute of your context to false (as Patrick mentioned) and add a post goal in maven on war:webapp to call tomcat:reload you should be right. Also, I find the war:inplace goal to be very useful when making JSP changes. Cheers, Dan

Posted by Dan Washusen on February 13, 2005 at 09:55 PM MST #

Post a Comment:
  • HTML Syntax: Allowed