WebLogic Cluster Sevlet的配置

虽然生产环境中不建议使用,但因为客户需要考试可能用到,所以又做了一遍

1. 配置受管Server,ProxyServer,过程略

2.构建Proxy Application

建立一个ProxyApp的应用

目录结构如下

ProxyApp

  |--WEB-INF

      |-- web.xml

      |-- weblogic.xml

其中web.xml内容为

<?xml version='1.0' encoding='UTF-8'?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <servlet>

    <servlet-name>HttpClusterServlet</servlet-name>

    <servlet-class>weblogic.servlet.proxy.HttpClusterServlet</servlet-class>

    <init-param>

      <param-name>WebLogicCluster</param-name>

      <param-value>localhost:7002|localhost:7003</param-value>

    </init-param>

  </servlet>

  <servlet-mapping>

    <servlet-name>HttpClusterServlet</servlet-name>

    <url-pattern>/</url-pattern>

  </servlet-mapping>

  <servlet-mapping>

    <servlet-name>HttpClusterServlet</servlet-name>

    <url-pattern>*.jsp</url-pattern>

  </servlet-mapping>

  <servlet-mapping>

    <servlet-name>HttpClusterServlet</servlet-name>

    <url-pattern>*.htm</url-pattern>

  </servlet-mapping>

  <servlet-mapping>

    <servlet-name>HttpClusterServlet</servlet-name>

    <url-pattern>*.html</url-pattern>

  </servlet-mapping>

</web-app>

也就是将访问/, *.jsp, *.htm,*.html的内容都转向localhost:7002和7003节点

Weblogic.xml为

<?xml version='1.0' encoding='UTF-8'?>

<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <context-root>/</context-root>

</weblogic-web-app>

3.将应用ProxyApp部署到ProxyServer.

4.测试.

原文地址:https://www.cnblogs.com/ericnie/p/5590345.html