HttpClusterServlet Configuration (Weblogic Server Acting as a Proxy)

To make a weblogic server act as a webserver, HttpClusterServlet is used. Below are the steps to create it:

–    Create 3 managed servers and add 2 managed servers to a cluster, let the third managed server be a standalone server

– Create 3 managed servers and add 2 managed servers to a cluster, let the third managed server be a standalone server
– Develop an application which will enable the managed server to act as a web server.
– Make a directory as D:AppsHttpClusterServlet in your disk which will be the directory of your application. Make a directory WEB-INF in HttpClusterServlet folder.

–    Now create web.xml inside WEB-INF and write the below in the xml file:

<?xml version=”1.0″ encoding=”UTF-8″?>

<web-app xmlns=”http://java.sun.com/xml/ns/j2ee”>

<servlet>
<servlet-name>HttpClusterServlet</servlet-name>
<servlet-class>weblogic.servlet.proxy.HttpClusterServlet</servlet-class>
<init-param>
<param-name>WebLogicCluster</param-name>
<param-value>localhost:7003|localhost:7005</param-value>
</init-param>
<init-param>
<param-name>verbose</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>DebugConfigInfo</param-name>
<param-value>ON</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>

–    Now create weblogic.xml in WEB-INF and write the below in the file.

<?xml version=”1.0″ encoding=”UTF-8″?>
<weblogic-web-app xmlns=”http://www.bea.com/ns/weblogic/90″>
<context-root>/</context-root>
</weblogic-web-app>

–    Now deploy the application HttpClusterServlet on the standalone server as below:

–    Now deploy your web application on the cluster as:

–    Now hit the application with the port of the ProxyMS which is 7007. Url would be something like http://127.0.0.1:7007/Jsp/one.jsp. The jsp page should appear.

If you have any questions, please let us know and we will be glad to help you.

Best Regards.

Now deploy your application on the cluster as:

5 comments

  1. its good.i have one doubt?

    it is possible to add the running stand-alone server to cluster.

    1. Hi Kumar,

      Yes it is possible, but it does not mean anything. There is no need of cluster when there is only one server.

      Best Regards,
      Wonders Team

  2. Hi Divya,
    Why you are specifying all the managed server address for WebLogicCluster parameter in web.xml?

    If you are specifying managed server address, when any managed server is added , this web.xml is also needs to be changed right?

    what is the use of making cluster in this case then?

    Regards
    naveen

  3. For our staging and production environment we have a setup where we are not using load balancers and http servers.
    Is this method safe to be used on staging and production?

    Thanks,
    Preety

Comments are closed.