如何在Weblogic中更改企业应用程序(.ear)的上下文根 [英] How to change context-root for enterprise application (.ear) in weblogic

查看:441
本文介绍了如何在Weblogic中更改企业应用程序(.ear)的上下文根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有基于Web的第三方企业应用程序,该应用程序部署在weblogic服务器上,并且可以使用

We have third party web based enterprise application, which is deployed on weblogic server and can be accessible using

http://hostname:port/myApp

但是,由于某些原因,我们想为此应用程序更改context-root,因此必须可以使用

But, due to some reason, we wanted to change context-root for this application, so that it must be ONLY accessible using

http://hostname:port/newApp

因此,为了实现这一目标,我们尝试更改application.xml

So, to achieve this, we tried changing application.xml

<?xml version = '1.0' encoding = 'utf-8'?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" version="1.4">
   <display-name>myApp</display-name>
   <module>
         <web>
            <web-uri>myApp.war</web-uri>
            <context-root>newApp</context-root>  // changed from myApp to newApp
         </web>
   </module>
</application>

但是,在Weblogic服务器上部署此应用程序时,我们遇到了以下错误.

But, while deploying this application on weblogic server, we are getting following error.

weblogic.management.DeploymentException: The application myApp contains a SubDeploymentMBean with a name myApp however there is no module in the application with that URI or context-root.

另一方面,如果我们同时保留context-root,如application.xml所示,则该文件将成功部署,并且还可以使用上下文根来访问应用程序.

On the other hand, if we keep both context-root as shown below application.xml file, then it gets deployed successfully and also able to access application using both context-root.

<?xml version = '1.0' encoding = 'utf-8'?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" version="1.4">
   <display-name>myApp</display-name>
   <module>
         <web>
            <web-uri>myApp.war</web-uri>
            <context-root>newApp</context-root>  // changed from myApp to newApp
         </web>
   </module>
   <module>
         <web>
            <web-uri>myApp.war</web-uri>
            <context-root>myApp</context-root>
         </web>
   </module>
</application>

有人可以帮助我解决此问题吗?如果需要其他信息,请告诉我.

Can anyone help me to resolve this issue ? Let me know, if additional information required.

==已编辑==

我已经添加了weblogic.xml文件,但不确定,我应该更改@Hououin Kyouma在他/她的答复中指出的内容.

I have added weblogic.xml file, but not sure, what I suppose to change in this file as pointed by @Hououin Kyouma in his/her answer.

<?xml version = '1.0' encoding = 'US-ASCII'?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
   <session-descriptor> 
      <cookie-path>/myApp</cookie-path> 
   </session-descriptor>
   <container-descriptor>
       <prefer-web-inf-classes>true</prefer-web-inf-classes>
   </container-descriptor>
</weblogic-web-app>

推荐答案

您不能在application.xml中用不同名称的war文件定义上下文根.

You cannot define a context root with a differently named war file in the application.xml

<module>
    <web>
        <web-uri>myApp.war</web-uri>
        <context-root>newApp</context-root>  // changed from myApp to newApp
    </web>
</module>

您必须在上面更改为

<module>
    <web>
        <web-uri>newApp.war</web-uri>    // changed from myApp to newApp
        <context-root>newApp</context-root>  
    </web>
</module>

您需要使用新名称创建战争.您仍然需要在新的war文件中更改weblogic.xml,但是只要这个问题继续存在,上面就是您需要做的.

You need to create the war with the new name. You will still need to change the weblogic.xml in the new war file, but as long as this question goes, above is what you need to do.

这篇关于如何在Weblogic中更改企业应用程序(.ear)的上下文根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆