想要在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”中。

参考资料:
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.

- 大小: 24.2 KB
分享到:
相关推荐
在WTP1.5.3版本中,开发Enterprise JavaBeans (EJBs) 需要一系列步骤,这些步骤涉及环境配置、项目创建、EJB编写和部署。以下是详细的过程: 1. **环境准备**:首先,确保已安装Eclipse IDE,并通过Eclipse ...
在JNDI中配置数据源(DataSource) 内嵌Jetty服务器 内嵌Jetty教程 内嵌Jetty的HelloWorld教程 内嵌Jetty视频 优化Jetty 如何配置垃圾收集 如何配置以支持高负载 在Jetty中部署应用 部署管理器 部署绑定 热部署 ...
6. **JNDI浏览**:用户可以查看和操作应用服务器的JNDI命名目录,这对于配置和调试J2EE应用非常有帮助。 7. **Maven集成**:虽然Lomboz主要关注Eclipse的原生开发流程,但在3.2版本中,它也开始支持Maven构建系统,...
在Eclipse中配置J2EE环境,需要安装WTP插件,以及对应的Web容器(如Tomcat)和数据库驱动(如MySQL的JDBC驱动)。安装完成后,还需要配置环境变量,确保系统能够找到Web容器和数据库驱动。 **JSP基本语法** JSP的...
书中提到的Eclipse插件可能包括用于J2EE开发的工具,如Web Tools Platform (WTP)、MyEclipse等,这些插件可以帮助开发者提高效率。 通过学习这本书,读者将掌握J2EE网络编程的基本概念、技术和实践方法,为构建高效...
3.3 配置Eclipse集成开发环境涉及到安装Java Development Kit (JDK)、设置JSP和Servlet编译器、配置服务器插件等步骤。Eclipse提供了内置的WTP(Web Tools Platform)项目,使得开发者可以直接在IDE内部管理服务器和...
10. **企业服务集成**:Eclipse JEE版还支持与各种企业服务集成,如JMS(Java Message Service)、JNDI(Java Naming and Directory Interface)等。 总之,"eclipse-jee-2021-03-R-win32-x86-64"是针对Java EE...
- **JNDI(Java Naming and Directory Interface)**:命名和目录服务接口,用于查找和管理资源。 - **JAF(JavaBeans Activation Framework)**:处理 MIME 类型和 JavaBeans 的激活。 - **JSF(JavaServer Faces)...