deevodavis
deevodavis

Reputation: 131

Tomcat specific web.xml settings

Is there a way to configure specific settings for my web application that will only be applied and acted upon when running under Tomcat?

We use Tomcat 6.0.29 as a development environment under Eclipse Helios as it's quick and easy for developers to use, but would then typically use a Java EE 6 container (Weblogic, Websphere, JBoss etc) for Production environments.

The specific issue I have is that for JAX-WS services running under Tomcat (a non Java EE server) I need to add a listener to web.xml (com.sun.xml.ws.transport.http.servlet.WSServletContextListener) and a servlet reference for each Web Services class I write. If using a true Java EE 6 container I don't have to do this as it auto-deploys the web services at EAR deployment time based on their @WebService annotations.

For other app servers there are files such as jboss-web.xml, geronimo-web.xml and weblogic.xml that I can put under WEB-INF, but does a similar thing exist for Tomcat?

Upvotes: 1

Views: 1340

Answers (1)

Tim Funk
Tim Funk

Reputation: 879

2 Solutions

  1. Use a custom listener which will detect you are running tomcat and if you are running tomcat - then instantiate the WSServletContextListener and call its init method.

  2. Edit CATALINA_BASE/conf/web.xml and add the listener - But this will be used for ALL webapps on that instance

Upvotes: 0

Related Questions