最近應工作需要,需要搭建weblogic中間件。其中遇到一些列的問題,例如如何在關閉服務器之間,正常關閉weblogic服務。一次非正常關閉weblogic服務帶來的麻煩,覺得應該爲剛入門weblogic的朋友寫點東西。雖然看到網上有各種各樣的weblogic資料,但是涉及關閉weblogic服務方面的資料比較少。語言組織能力較差,請輕噴!
常用關閉weblogic的服務方法是使用weblogic自帶的stopManagedWebLogic.sh腳本,具體使用方法這裏不再贅述。但經常遇見管理失敗的情況,提示如下:
root@twls08 bin]# sh stopManagedWebLogic.sh twls08 http://10.60.7.2:7001
Stopping Weblogic Server...
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to http://10.60.7.2:7001 with userid weblogic ...
This Exception occurred at Sat Oct 31 20:15:20 CST 2015.
javax.naming.CommunicationException [Root exception is java.net.ConnectException: http://10.60.7.2:7001: Destination unreachable; nested exception is:
java.net.ProtocolException: Tunneling result unspecified - is the HTTP server at host: '10.60.7.2' and port: '7001' a WebLogic Server?; No available router to destination]
Problem invoking WLST - Traceback (innermost last):
File "/Oracle/Middleware/weblogic/user_projects/domains/lb_domain/shutdown.py", line 3, in ?
File "<iostream>", line 22, in connect
File "<iostream>", line 648, in raiseWLSTException
WLSTException: Error occured while performing connect : Error getting the initial context. There is no server running at http://10.60.7.2:7001
Use dumpStack() to view the full stacktrace
Done
Stopping Derby Server...
[root@twls08 bin]# ps aux|grep start
非正常關閉weblogic服務的故障如下,數據源無法正常使用,解決方法爲刪除原數據源,新建數據源。筆者認爲,導致該故障的原因爲非正常關閉導致數據源相關配置和狀態信息改變,導致無法正常使用數據源。
解決方法:
方法1. 啓用隧道協議關閉
如上報錯紅色部分提示,沒有指定隧道。啓用後,需要重新啓動weblogic服務器才能使用。
啓動隧道方式如下圖
方法2. 使用weblogic t3協議關閉服務
使用方法1關閉weblogic時會發現,必須重新啓動服務後才能正常使用,簡言之就是仍需要一次非常關閉服務才能使用。這裏推薦使用第二種方法,使用t3協議關閉。什麼是t3協議,T3也稱爲豐富套接字,是BEA內部協議,功能豐富,可擴展性好。
T3是多工雙向和異步協議,經過高度優化,只使用一個套接字和一條線程。藉助這種方法,基於Java的客戶端可以根據服務器方需求使用多種RMI對象,但仍使用一個套接字和一條線程。
默認使用http協議關閉:sh stopManagedWebLogic.sh twls08 http://10.60.7.2:7001
使用t3協議關閉方式:sh stopManagedWebLogic.sh twls08 T3://10.60.7.2:7001
就是如此簡單,如果廣大網友有更好的方法,請留言,謝謝!