[转帖]配置基于Coherence *Web的WebLogic Server会话管理2_Tomcat, WebLogic及J2EE讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Tomcat, WebLogic及J2EE讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 4937 | 回复: 0   主题: [转帖]配置基于Coherence *Web的WebLogic Server会话管理2        下一篇 
masy
注册用户
等级:少校
经验:1234
发帖:182
精华:0
注册:2011-11-4
状态:离线
发送短消息息给masy 加好友    发送短消息息给masy 发消息
发表于: IP:您无权察看 2011-11-9 16:23:29 | [全部帖] [楼主帖] 楼主

《配置基于Coherence *Web的WebLogic Server会话管理》中介绍了如何将Coherence *Web与WebLogic Server集成,当时使用的WebLogic Server 10.3.2与Coherence 3.5,由于在那时还没引入作用域的概念,所以Coherence的作用域是全局性的,也就是说不管在WebLogic Server上部署多少应用,不管你想不想,所有的应用都必须使用Coherence接管的会话管理。这种方式带来的问题也是很明显的,首先由于全局使用一个Coherence Cluster,这就会引发会话变量的命名冲突问题。其次,是管理上无法针对不同的应用配置不同的配置选项,例如:会话模型(Session Model)。

Oracle Coherence 3.6版中解决了这个问题,此版本中引入了三种作用域:

  • 应用服务器作用域
  • EAR应用作用域
  • WAR应用作用域

实验环境准备

  • 介质版本分别为:WebLogic 10.3.3与Coherence 3.6
  • 随WebLogic Server 10.3.3一同安装的Coherence版本为3.5,我们需要下载Coherence 3.6覆盖原来的Coherence或使用其它目录存放Coherence 3.6
  • 此实验中所涉及的coherence.jar与coherence-web-spi.war都位于%COHERENCE_HOME%/lib目录下
  • 由于此版本中WebLogic Server启动时默认关闭了本地存储(local store),所以在实验前,确保%COHERENCE_HOME%/bin/

    cache-server.cmd选启动,然后再启动WebLogic Server实例。

配置应用服务器作用域集群节点

1. 将coherence.jar与%WL_HOME%/common/deployable-libraries/active-cache.jar加到WebLogic Server系统加路径中。

注:active-cache.jar一定要放在%WL_HOME%/common/deployable-libraries/目录下,并且加到类路径下。可以通过修改%DOMAIN_HOME%/bin/startWebLogic.cmd来更改类路径,此处不详述。

2. 将coherence-web-spi.war发布为共享库

3. 修改应用的weblogic.xml配置文件:

view plaincopy to clipboardprint?

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <WLS:WEBLOGIC-WEB-APP 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" xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
  3.     <WLS:WEBLOGIC-VERSION>10.3.2</WLS:WEBLOGIC-VERSION>  
  4.     <WLS:CONTEXT-ROOT>CoherenceWeb</WLS:CONTEXT-ROOT>  
  5.     <WLS:LIBRARY-REF>  
  6.         <WLS:LIBRARY-NAME>coherence-web-spi</WLS:LIBRARY-NAME>  
  7.         <WLS:SPECIFICATION-VERSION>1.0.0.0</WLS:SPECIFICATION-VERSION>  
  8.         <WLS:EXACT-MATCH>true</WLS:EXACT-MATCH>  
  9.     </WLS:LIBRARY-REF>  
  10. </WLS:WEBLOGIC-WEB-APP>  


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

10.3.2
CoherenceWeb

coherence-web-spi
1.0.0.0
true

4. 测试方法

分别创建两个domain_a与domain_b,按照步骤1,2分布在两个domain上配置,将应用CoherenceWeb.war分别部署在两个domain中。访问domain_a上的应用CoherenceWeb,更新会话变量值,通过domain_b上的应用CoherenceWeb查看会话变量值的变化情况。如果两个应用中会话变量同步变化就算是成功了

5. 下载测试用应用包:CoherenceWeb.war

配置EAR作用域集群节点

1. 以共享库的方式部署active-cache.jar及coherence-web-spi.war

2. 将coherence.jar放入应用的lib目录下

3. 修改META-INF/weblogic-application.xml

view plaincopy to clipboardprint?

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <WLS:WEBLOGIC-APPLICATION xsi:schemalocation="http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application.xsd http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd" xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
  3.   <WLS:LIBRARY-REF>  
  4.         <WLS:LIBRARY-NAME>coherence-web-spi</WLS:LIBRARY-NAME>  
  5.     </WLS:LIBRARY-REF>  
  6.     <WLS:COHERENCE-CLUSTER-REF>  
  7.         <WLS:COHERENCE-CLUSTER-NAME>CoherenceCluster</WLS:COHERENCE-CLUSTER-NAME>  
  8.     </WLS:COHERENCE-CLUSTER-REF>  
  9. </WLS:WEBLOGIC-APPLICATION>  


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

coherence-web-spi

CoherenceCluster

4. 修改应用的META-INF/MANIFEST.MF

Extension-List: active-cache
active-cache-Extension-Name: active-cache
active-cache-Specification-Version: 1.0
active-cache-Implementation-Version: 1.0

6. 测试方法

分访问CoherenceTest.ear中的CoherenceWebA与CoherenceWebB,看是否访问正常。

5.  下载测试用应用包:CoherenceTest.ear

配置WAR-作用域集群节点

1. 以共享库的方式部署active-cache.jar及coherence-web-spi.war

2. 复制coherence.jar到应用的WEB-INF/lib目录下

3. 修改WEB-INF/weblogic.xml

view plaincopy to clipboardprint?

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <WLS:WEBLOGIC-WEB-APP 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" xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
  3.     <WLS:WEBLOGIC-VERSION>10.3.2</WLS:WEBLOGIC-VERSION>  
  4.     <WLS:CONTEXT-ROOT>CoherenceWeb</WLS:CONTEXT-ROOT>  
  5.     <WLS:LIBRARY-REF>  
  6.         <WLS:LIBRARY-NAME>coherence-web-spi</WLS:LIBRARY-NAME>  
  7.     </WLS:LIBRARY-REF>  
  8.     <WLS:COHERENCE-CLUSTER-REF>  
  9.         <WLS:COHERENCE-CLUSTER-NAME>CoherenceCluster</WLS:COHERENCE-CLUSTER-NAME>  
  10.     </WLS:COHERENCE-CLUSTER-REF>  
  11. </WLS:WEBLOGIC-WEB-APP>  


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

10.3.2
CoherenceWeb

coherence-web-spi

CoherenceCluster

这里的<wls:coherence-cluster-ref>元素可选,如果有多个应用使用Coherence *Web,此项必须用以避免命名冲突

4. 修改应用的META-INF/MANIFEST.MF

Extension-List: active-cache
active-cache-Extension-Name: active-cache
active-cache-Specification-Version: 1.0
active-cache-Implementation-Version: 1.0

5.  发布应用

6. 测试方法

分别部署CoherenceWebC.war与NoCoherenceWeb.war,通过应用CoherenceWebC更改会话变量值,通过应用NoCoherenceWeb查看会话变量值的变化情况,如果NoCoherenceWeb的会话变量值不随NoCoherenceWeb会话值的变化而变化,则测试成功

7. 测试代码下载:CoherenceWebC.warNoCoherenceWeb.war




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论