【Apache】代理的配置與weblogic.xml配置

本文不是教程,是記錄,因爲還沒完全搞明白,純粹記一下,以備後續使用。
問題:兩臺服務器分別用weblogic部署了同一應用,用apche配置代理進行訪問,但是單點登錄沒問題,代理登錄就有問題
分析:因爲是接手項目,第一次搞Apache,看了老久才找到原因,瞭解了一點兒apche,後續還需深入。最後問題是session問題

1.weblogic.xml

問題的第一個要點是應用的WEB-INF下面的weblogic.xml文件,裏面的session-descriptor 配置
底下這段中JSESSIONYYQ是唯一的,不能與其他應用重複,但兩個節點的值務必要保持一致

 <param-value>JSESSIONYYQ</param-value>

weblogic.xml樣例

<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 6.0//EN" "http://www.bea.com/servers/wls610/dtd/weblogi
c-web-jar.dtd">
<weblogic-web-app>
  <context-root>/irms</context-root>
  <session-descriptor>
          <session-param>
            <param-name>CookieName</param-name>
            <param-value>JSESSIONYYQ</param-value>
          </session-param>
  </session-descriptor>
  <container-descriptor>
        <prefer-web-inf-classes>false</prefer-web-inf-classes>
        <show-archived-real-path-enabled>false</show-archived-real-path-enabled>
   </container-descriptor>
</weblogic-web-app>

改過後清緩存重啓

2.apache代理配置httpd.conf

另一個文件是apache的代理配置文件

/home/yyq/apache/conf/httpd.conf

裏面的WLCookieName JSESSIONYYQ
這個就對應上面weblogic裏面的param-value

<Location /yyq>
 SetHandler weblogic-handler
 WeblogicCluster 10.111.222.111:7001,10.111.222.112:7001
 MatchExpression /yyq
 #WLLogFile "/home/logonuser/irmsprojects/wllogs/wlproxy.log"
 Debug On
 DebugConfigInfo On
 WLCookieName JSESSIONYYQ
 KeepAliveEnabled On
 KeepAliveSecs 15
</Location>

3.配置好後重啓

啓動方法:

./apachectl start

停用方法:

./apachectl stop

參考文件:
竟然找到個前輩的文章,雖然不知是誰
Apache HTTP反向代理和weblogic集羣部署(session複製)

應用的Session衝突
weblogic + apache 負載均衡與Session複製

Weblogic Session 共享

一.編輯weblogic.xml

配置文件放到WEB應用程序的WEB-INF目錄下,內容如下:

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

二.執行業務操作

在IE地址欄中輸入例如http://210.41.121.134:8080/,並登錄系統執行業務操作,這時你可以隨便關閉或打開Managed_Server_1或Managed_Server2,只要保持有一個Managed_Server是啓動狀態,業務操作仍可繼續執行,不必重新登錄。
出現錯誤:
Replicated HTTP sessions specified for webapp , but clustering not enabled
這個是由於weblogic.xml裏面的 PersistentStoreType 這個設置不符合造成
雙機狀態一般是PersistentStoreType 爲replicated
單機爲PersistentStoreType 爲memory
就不會出現標題的異常

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章