WTP配置JNDI



 想要在WTP环境下面配置JNDI,有两种方式,一种是在Server工程的server.xml中编写jndi的xml标签,但是如果不想这么做,而是想在"conf\Catalina\localhost"下面新建个xml应该怎么做呢,直接在wtp的发布目录下的“conf\Catalina\localhost”中新建一个工程名.xml是不行的,因为每次服务器启动这个文件都会被覆盖。可以再工程的WebRoot/META-INF文件夹下面新建一个context.xml,把你的context配置和jndi配置写在这个文件里面,然后在打开服务器配置界面,勾选“publish module context to separate XML file”就大功告成了。启动服务器context.xml的内容会被复制到“conf\Catalina\localhost”中。

 

WTP配置JNDI_第1张图片

 

参考资料:

http://wiki.eclipse.org/WTP_Tomcat_FAQ#How_do_I_specify_the_Tomcat_context_configuration_for_my_Web_Application.3F

 

 

How do I specify the Tomcat context configuration for my Web Application?

The configuration within <Context> elements may be added to the server.xml file associated with the Tomcat server, after the project has been added to the server. Note that if the project is removed from the server, this configuration will be lost. You can save a copy of the configuration in some file in your project if you want to persist this information.

Another approach is use the support found in Tomcat 4.1 and later for specifying context configuration within a META-INF/context.xmlfile found in the Web application. If a project containing a META-INF/context.xml file is added to one of these Tomcat servers in WTP, the context configuration found in this file will be included in the context for that project when server.xml, or separate context XML file in WTP 2.0.x and later, is file copied as part of publishing the server. When adding the configuration from the META-INF/context.xml file, all child elements of the <Context> are copied as well as its attributes, excluding the "path" and "docBase" attributes.

 

你可能感兴趣的:(eclipse,tomcat,xml,Web)