WebLogic Cluster"

From Documentation
m
 
(10 intermediate revisions by 5 users not shown)
Line 4: Line 4:
 
==zk.xml ==
 
==zk.xml ==
 
* Turn on Serializable UI Factory for ZK, please refer to [[ZK_Developer's_Reference/Clustering/ZK_Configuration | this documentation]].
 
* Turn on Serializable UI Factory for ZK, please refer to [[ZK_Developer's_Reference/Clustering/ZK_Configuration | this documentation]].
* Comment out this, if any. (by default, we use <javadoc>org.zkoss.zk.ui.impl .SessionDesktopCacheProvider</javadoc> and it works well)
 
 
<source lang="xml">
 
<source lang="xml">
<system-config>
+
<zk>
    <cache-provider-class>org.zkoss.zk.ui.sys.GlobalDesktopCacheProvider</cache-provider-class>
+
<system-config>
</system-config>
+
<ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class>
 +
</system-config>
 +
<!-- clustering environment, since ZK 5.0.8-->
 +
<listener>
 +
<listener-class>org.zkoss.zkplus.cluster.ClusterSessionPatch</listener-class>
 +
</listener>
 +
</zk>
 
</source>
 
</source>
'''Note:''' we cannot use GlobaDesktopCacheProvider for Cluster because it is stored at ''ServletContext'' scope not ''Session'' scope. In other words, if one server fails, then the cluster will try to replicate the session across different server, so the data we stored in ''ServletContext'' won't transfer to others.
 
  
 
== weblogic.xml ==
 
== weblogic.xml ==
Line 16: Line 20:
 
For example,
 
For example,
 
<source lang="xml">
 
<source lang="xml">
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
+
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN"
 +
"http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
  
 
<weblogic-web-app>
 
<weblogic-web-app>
Line 27: Line 32:
 
</weblogic-web-app>
 
</weblogic-web-app>
 
</source>
 
</source>
 +
 +
For Weblogic version 12c
 +
<source lang="xml">
 +
<?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.5/weblogic-web-app.xsd">
 +
<wls:session-descriptor>
 +
<wls:persistent-store-type>replicated</wls:persistent-store-type>
 +
</wls:session-descriptor>
 +
</wls:weblogic-web-app>
 +
</source>
 +
 
As mentioned in [http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webapp/weblogic_xml.html#wp1071982 Weblogic's document]
 
As mentioned in [http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webapp/weblogic_xml.html#wp1071982 Weblogic's document]
 
  '''replicated''' — Same as memory, but session data is replicated across the clustered servers.
 
  '''replicated''' — Same as memory, but session data is replicated across the clustered servers.
Line 32: Line 51:
 
= Setting up Weblogic Clusters=
 
= Setting up Weblogic Clusters=
 
After those things done above, please follow the official document to set up a Weblogic Cluster Server [http://download.oracle.com/docs/cd/E12840_01/wls/docs103/cluster/setup.html here].
 
After those things done above, please follow the official document to set up a Weblogic Cluster Server [http://download.oracle.com/docs/cd/E12840_01/wls/docs103/cluster/setup.html here].
 +
 +
= Including zul in JSP in Weblogic=
 +
Weblogic JSP writer implementation uses response#getOutputStream for JSP blocks.
 +
Using the <source><jsp:include src="foo/bar/mypage.zul"></source> tag in weblogic will cause the ZK layout servlet to write the zul file to response#getWriter.
 +
 +
This will cause an error "Cannot call outputStream because getWriter was already called"
 +
 +
Instead, use
 +
<source>
 +
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
 +
<c:import var = "data" url = "foo/bar/mypage.zul"/><c:import>​
 +
</source>
 +
 +
* <distributable/> in web.xml is not used by WebLogic Server 12c. (https://docs.oracle.com/cd/E24329_01/web.1211/e21049/web_xml.htm#WBAPP510)
 +
 
=Version History=
 
=Version History=
 +
{{LastUpdated}}
  
 
{| border='1px' | width="100%"
 
{| border='1px' | width="100%"
 
! Version !! Date !! Content
 
! Version !! Date !! Content
 
|-
 
|-
| &nbsp;
+
| 5.0.8
| &nbsp;
+
| June 2011
| &nbsp;
+
| Add ClusterSessionPatch listener to zk.xml for enforce Weblogic to write session.
 
|}
 
|}
  
 
{{ZKInstallationGuidePageFooter}}
 
{{ZKInstallationGuidePageFooter}}

Latest revision as of 10:26, 10 May 2022


Before You Start

You have to configure the following setting for ZK and Weblogic.

zk.xml

<zk>
	<system-config>
		<ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class>
	</system-config>
	<!-- clustering environment, since ZK 5.0.8-->
	<listener>
		<listener-class>org.zkoss.zkplus.cluster.ClusterSessionPatch</listener-class>
	</listener>
</zk>

weblogic.xml

  • Add a weblogic.xml under XXX/WEB-INF folder(XXX is like ZKsandbox in the war file)

For example,

<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN"
 "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">

<weblogic-web-app>
  <session-descriptor>
    <session-param>
      <param-name>PersistentStoreType</param-name>
      <param-value>replicated</param-value>
    </session-param>
  </session-descriptor>
</weblogic-web-app>

For Weblogic version 12c

<?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.5/weblogic-web-app.xsd">
	<wls:session-descriptor>
		<wls:persistent-store-type>replicated</wls:persistent-store-type>
	</wls:session-descriptor>
</wls:weblogic-web-app>

As mentioned in Weblogic's document

replicated — Same as memory, but session data is replicated across the clustered servers.

Setting up Weblogic Clusters

After those things done above, please follow the official document to set up a Weblogic Cluster Server here.

Including zul in JSP in Weblogic

Weblogic JSP writer implementation uses response#getOutputStream for JSP blocks.

Using the

<jsp:include src="foo/bar/mypage.zul">

tag in weblogic will cause the ZK layout servlet to write the zul file to response#getWriter.

This will cause an error "Cannot call outputStream because getWriter was already called"

Instead, use

<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<c:import var = "data" url = "foo/bar/mypage.zul"/><c:import>​

Version History

Last Update : 2022/05/10


Version Date Content
5.0.8 June 2011 Add ClusterSessionPatch listener to zk.xml for enforce Weblogic to write session.



Last Update : 2022/05/10

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.