Websphere 8.5上下文根更改不适用于war文件

use*_*737 7 websphere contextroot websphere-8

我需要一些帮助来改变我的Websphere 8.5 appserver中我的战争的上下文根.我有一个war文件调用test.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>
Run Code Online (Sandbox Code Playgroud)

当我再次部署时,context-root仍然是/test该文件无效.有什么我想念的吗?

Gas*_*Gas 10

安装后最简单的方法是打开Web管理控制台并通过以下方式更改context-root:

Applications > Application Types > WebSphere enterprise applications > application_name > Context root for web modules.
Run Code Online (Sandbox Code Playgroud)

您也可以通过wsadmin脚本执行此操作.

您可以通过管理控制台在应用程序安装期间提供上下文名称,也可以在安装之前将文件名更改为默认上下文,当您从文件名中获取安装war时.

最后一个选项是创建EAR并使用web模块定义application.xml,如下所示:

<web>
  <web-uri>test.war</web-uri>
  <context-root>example</context-root>
</web>
Run Code Online (Sandbox Code Playgroud)