Community
Participate
Working Groups
Build Identifier: 20100218-1602 According to the FAQ at http://wiki.eclipse.org/WTP_Tomcat_FAQ, a context.xml file placed within the META-INF/ directory in the war will be used as the context for the application when tomcat is loaded by eclipse. This however doesn't work. To reproduce: - Place a context.xml within the META-INF directory within a war project. - Unpack a pristine copy of apache-tomcat v6.0.26. - Add a tomcat 6.0 server, point it at the prisine copy. - Add the war project to the list of tomcat projects. - Start up tomcat, and hit a test URL showing the <Environment> entries from the servlet context. These show the default entries from the servlet, the parameters in context.xml are ignored. As a result, you have to hack at the war web.xml file to get temporary parameters into the servlet while developing, which is very ugly. Reproducible: Always Steps to Reproduce: xxx
Try taking a look at Bug# 215228, hope it helps. If not Larry, should be able to assist you with more info.
A simple test works for me. Check the server.xml down under "<workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmp?/conf" and see if the <Context> it contains for your project includes your <Environment> element(s).
A simple test for me does not work. My context.xml in META-INF contains <Context path="/my-context-path" debug="0"> <Resource name="jdbc/GoDocumentDB" auth="Container" type="javax.sql.DataSource" removeAbandoned="true" removeAbandonedTimeout="30" maxActive="10" maxIdle="30" maxWait="10000" username="godoc" password="godoc" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/my-app" validationQuery="select 1 from dual"/> </Context> The complete resource element is 'ignored' (have not tried other elements). It makes no difference if I use the option to have separate files or have it integrated in the server.xml. In both cases I see a <Context docBase="/home/user1/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/my-app-webapp" path="/my-app-webapp" reloadable="true" source="org.eclipse.jst.j2ee.server:my-app-webapp"/>
The server.xml under the Servers project in your workspace is unaffected by an META-INF/context.xml in your project. It is the "merged" server.xml or context XML created during publishing (appears under the ".metadata\.plugins\org.eclipse.wst.server.core\tmp?\conf" directory by default) that should contain the child <Resource>. Is that what you are looking at?
Marking as WORKSFORME since the last question remains unanswered. I'm assuming that the context.xml content was expected to appear in the server.xml found under the Servers project. The content is actually merged during publishing and only appears in the published server.xml or separate context XML file for the context.