Caching Problems with context.xml in Tomcat 6

I recently spent a whole day trying to figure out a problem I was having with Tomcat 6. I had configured a connection pool for MySQL in my webapp’s META-INF/context.xml file and put a resource reference in WEB-INF/web.xml. However, when I tried deploying it to Tomcat, I kept getting the following error:

Cannot create JDBC driver of class '' for connect URL 'null'

Unfortunately, all the posts I found about solving this problem weren’t helpful to me. I had configured the connection correctly in the right format for context.xml for Tomcat 6, I had my JDBC Connector jar only in TOMCAT_HOME/lib, and so on.

Finally, however, I stumbled upon the problem: Tomcat was caching an old version of my context.xml that lacked the connection info. To solve this, I stopped Tomcat, deleted TOMCAT_HOME/conf/Catalina/localhost/mywebapp.xml, and then restarted this. After this, Tomcat had the correct version of context.xml, and my database connection worked correctly.

While this caching caused problems for connection pooling, I suppose that it could afflict anything that depends on changes in context.xml.

About thesgc

You've reached the bio of Stephen Cathers... View all posts by thesgc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.