Tomcat context file ignored

I joined a project that runs a webapp in place, rather than copying it to Tomcat's webapps subdirectory. It does this by having Ant create a context file in conf/Catalina/localhost once. My problem is that IDEA does not copy this file to the CATALINA_BASE that it makes in its cache, so the webapp doesn't run when I start Tomcat from IDEA. Is there some way I can configure IDEA to work with this project?

One work-around is to manually copy the file to IDEA's cache each time after starting Tomcat. But this is annoying. Any other drawbacks?

Another work-around might be to run Tomcat outside IDEA, connecting with the remote debugger as necessary. What would I loose this way?

A more radical alternative might be to copy the webapp on deployment instead of running in place. But, I think I'd need to put the context file into META-INF/context.xml and change its docBase, so I can't do this as it would affect everyone on the project. They expect to gain a faster development cycle by running in place.

I'm using IDEA 5.0.1 with Tomcat 5.0.28.

Incidentally, the context file is using an XML ENTITY include to keep some sensitive parameters in a separate file. E.g., conf/Catalina/localhost/foo.xml contains:

<![CDATA[ maxIdle 50 &bar; ]]>

Comment actions Permalink

Did you try 'Web Module Settings' -> 'Deployment Descriptors' -> 'Add...'
Than add your META-INF/context.xml

Comment actions Permalink

Thanks for the suggestion. The project doesn't have a META-INF/context.xml, but I tried adding the conf/Catalina/localhost/foo.xml as a Deployment Descriptor. IDEA shows its type as Additional Resource, which is good because it's not a web.xml. Unfortunately IDEA still didn't copy it to the CATALINA_BASE that IDEA made in its cache. (IDEA even removed the one I copied there before.)


Comment actions Permalink


We've had to run Tomcat outside IDEA (well, actually, we've configured it as an external tool so we can run and stop it from IDEA). It's no problem to connect with a debugger using an IDEA "Remote" runtime configuration. However, I haven't been able to debug JSPs using this approach - debugging "normal" Java code (servlets etc.) works fine though. The other thing you lose is that it's just not so nicely integrated with IDEA as we have to run the external tool and then run the debugger. You also need to remember to make the project before running tomcat (though maybe you could make tomcat check for changed classes and reload them to get around this).

Just in case you haven't come across it, here's a thread I started about Tomcat/IDEA integration - some of it might be of interest to you:

Hope this helps,



Please sign in to leave a comment.