通過websphere部署以及打包成war的web項目。
(1)安裝配置war包,部署項目
登錄websphere,進入websphere主頁(依次選中)
Applications --> Application Types --> websphere Enterprise Application --> install
打開選擇文件,選擇需要上傳的war包,然后點擊next 。(這里需要一點點時間,因為需要將war包上傳到websphere)
上傳完后,選中如圖示,點擊next
開始進入step步驟。
step1:選中Distribute Application ,選中 Create MBeans for resources,點擊next
step2:選中 select ,點擊next.
step3:選中select ,並右側的虛擬主機使用 default_host(默認的就是default_host),點擊next
step4:在Context Root那一欄下面寫上項目名,就是war包的前綴部分,用來訪問這個項目(這里一定要寫,不然就無法正常啟動),點擊next
示例: 比如上傳的是 Webdemo.war,Context Root目錄下就寫 /Webdemo
step5:直接點擊next.
step6:點擊finish.(等待項目安裝)
安裝完之后,點擊save(頁面的下方位置,藍色字體)
此時,war包已經上傳安裝成功了。系統自動跳轉到啟動頁面。
選中剛剛上傳的war包(WebdemoIn7.war),然后點擊start。(啟動成功時,右側的紅色叉叉會變成綠色箭頭)
可以開始嘗試訪問,在地址欄輸入訪問地址: https://安裝websphere的主機IP:port/${Context Root欄填寫的地址}
例如: https://172.150.12.43:9043/WebdemoIn7
(2)如果訪問出錯, 錯誤內容類似:SRVE0255E: A WebGroup/Virtual Host to handle /p2pd/servlet/dispatch has not been defined.
可通過以下步驟解決:
檢查項目配置
1. 點擊Applications --> Application Types --> Websphere enterprise ,點擊部署出錯的那個項目,例如 WebdemoIn7.war
2.查看 Web Module properties 模塊下面的 Virtual hosts
3.選中 select,並且將virtual hosts選中為 default_host,然后點擊 ok .
之后會回到 configuration頁面,點擊上方的 save .
檢查環境配置
第一步,點擊 Environment --> Virtual Hosts ,然后選中 default_host
第二步,點擊 Host Aliases,檢查有沒有自己安裝時配置訪問websphere的端口
如果沒有就new一個,並且設置host name為 * 。(這里主要配置host name 為 *,port為你安裝websphere時的端口),點擊 ok,然后 save .
檢測服務配置
1). 依次選中 Servers --> Server Types --> Websphere Application Servers ,然后選擇右側出現的那個服務,例如我的是 server1
2).選擇 Container Settings --> Web Container Settings --> Web Container
確定 Default_virtual_host指定的默認虛擬主機為 default_host ,然后點擊 ok . 點擊 save 。
最后重新啟動 websphere,再次訪問項目,在地址欄中輸入訪問鏈接。 https://172.150.12.43:9043/WebdemoIn7 便能訪問成功。
錯誤解決方法參考鏈接:http://blog.csdn.net/jason_wang1989/article/details/47128603