设置WebLogic10.x默认目录为根目录

网上有介绍如何把默认目录为根目录设置,但都是比较旧的版本了,本文介绍WebLogic10.x版本的设置;

使用根目录作为默认目录,同样需要新建一个工程可以叫做index,然后在在WEB-INF目录下面新建一个weblogic.xml,把context-root设置为"/"

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation
="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<wls:context-root>/</wls:context-root>
</wls:weblogic-web-app>

新建web.xml文件,welcome-file中指定一个跳转页面比如是index.html,之后想默认跳转到任何应用都可以通过这个跳转页进行。内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>index</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

如果需要更改端口(如监听80端口),需要在相关域下面的config目录中修改config.xml:

<server>
<name>server80</name>
<listen-port>80</listen-port>
<listen-address>你的监听IP地址</listen-address>
</server>

打包,部署在80端口的节点里即可。

原文地址:https://www.cnblogs.com/ibook360/p/2288623.html