我需要一些帮助来更改我的 Websphere 8.5 应用服务器中的 war 的上下文根。
我有一个名为 test.war
的 war 文件当我将它部署到 websphere 时,上下文根是 /test
但是我想将其更改为 /example
当我在网上查看时,我读到我需要包含 WEB-INF/ibm-web-ext.xml
在 test.war
内所以我添加了它并输入以下内容:
<web-ext
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
version="1.0">
<context-root uri="/example"/>
</web-ext>
当我再次部署时,上下文根仍然是
/test
该文件没有任何效果。有什么我想念的吗?
最佳答案
安装后最简单的方法是打开 Web 管理控制台并通过以下方式更改上下文根:
Applications > Application Types > WebSphere enterprise applications > application_name > Context root for web modules.
您也可以通过 wsadmin 脚本执行此操作。
您可以在应用程序安装期间通过管理控制台提供上下文名称,或者您可以在安装之前将文件名更改为默认上下文,当您安装时,war 取自文件名。
最后一个选项是创建 EAR 并使用 web 模块定义 application.xml,如下所示:
<web>
<web-uri>test.war</web-uri>
<context-root>example</context-root>
</web>
关于Websphere 8.5 上下文根更改不适用于 war 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24472790/