且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在同一服务器中跨 Web 应用程序共享 servlet 上下文

更新时间:2023-11-22 17:36:04

目前看起来还不错.显然它已被其他地方维护/生成的 context.xml 覆盖.您可以阅读 Tomcat 的 Context关于规则的配置参考.例如,您在 webapp 的 /META-INF 中有一个吗?然后你应该在那里定义 crossContext .

It looks fine so far. Apparently it's been overridden by a context.xml maintained/generated elsewhere. You can read in the Tomcat's Context configuration reference about the rules. Do you for example have one in webapp's /META-INF? You should then define crossContext in there.

或者您是否使用 Eclipse 之类的 IDE 来部署 Web 应用程序或其他什么?然后必须将 IDE 配置为不部署到工作区元数据,而是直接部署到 Tomcat,否则 Eclipse 将使用自己的 context.xml 副本(您可以在 Servers 项目).您可以在服务器的首选项中对其进行配置.这是来自 Eclipse 的屏幕:

Or are you using an IDE like Eclipse to deploy the webapps or something? The IDE has then to be configured to not deploy into workspace metadata, but straight into Tomcat, otherwise Eclipse will use its own copy of context.xml (which you can find in Servers project). You can configure it in the server's preferences. Here's a screen from Eclipse: