1??????
目的
在進行
Globus
項目開發的過程中,需要在
Windows
下通過
Web
服務調用
Globus
的服務(如
RFT
)。但是在編寫程序的時候遇到了一系列的問題。幾經周折,終于搞定。遂將解決方法總計如下,以供大家參考。
2??????
證書問題
由于
Globus
的安全問題,需要使用證書才能訪問服務。這里,有三種證書,分別是
CA
證書、用戶證書和代理證書。我們可以從以及安裝好
Globus
的
Linux
主機上將用戶證書(連同用戶的私鑰)和
CA
證書一同拷貝到
Windows
上使用。
用戶證書和用戶私鑰通常位于用戶根目錄中:
$HOME\.globus\usercert.pem
$HOME\.globus\userkey.pem
用戶證書和用戶私鑰用來生成代理證書。
CA
證書在校驗用戶證書的有效性時使用,位于
/etc/grid-security/certificates/a3989c00.0
代理證書是訪問
Globus
服務時實際使用的證書,它可以通過上面的證書來生成。但是生成代理證書需要進行如下操作。
2.1
??
安裝
ws-core
設置環境變量
GLOBUS_LOCATION
,
set %GLOBUS_LOCATION%=some_where_ws-core_installed
下載
ws-core-4.0.1-bin.zip
(這里面的版本由需要決定)文件,解壓到
%GLOBUS_LOCATION
目錄下。
2.2
??
安裝
cog-jglobus
設置環境變量
COG_INSTALL_PATH
,
set %COG_INSTALL_PATH=some_where_cog-jglobus_installed
從
http://wiki.cogkit.org
下載
cog-jglobus-1.4-bin.zip
,解壓到
%COG_INSTALL_PATH
目錄。
運行:
%COG_INSTALL_PATH\bin\setup
根據提示,指定用戶證書、私鑰,
CA
證書以及代理證書的位置。
成功安裝后,會在
Windows
用戶根目錄下生成
.globus
目錄,并在該目錄下建立一個
cog.properties
文件。該文件內容大致如下:
#Java CoG Kit Configuration File
#Tue Dec 12 18:34:00 CST 2006
usercert=C\:\\Documents and Settings\\Administrator\\.globus\\usercert.pem
userkey=C\:\\Documents and Settings\\Administrator\\.globus\\userkey.pem
proxy=C\:\\DOCUME~1\\ADMINI~1\\LOCALS~1\\Temp\\x509up_u_administrator
cacert=C\:\\Documents and Settings\\cert\\a3989c00.0
后面,
grid-proxy-init
會根據這個文件來查找和生成證書。
如果沒有正確設置
cog.properties
文件,會產生如下異常:
Exception in thread "main" . Caused by AxisFault
?faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.userException
?faultSubcode:
?faultString:
org.globus.common.ChainedIOException
: Authentication failed [Caused by: Failure unspecified at GSS-API level [Caused by: Unknown CA]]
?faultActor:
?faultNode:
?faultDetail:
??? {http://xml.apache.org/axis/}stackTrace:Authentication failed. Caused by Failure unspecified at GSS-API level. Caused by
COM.claymoresystems.ptls.SSLThrewAlertException
: Unknown CA
這是由于無法定位
CA
證書造成的。
2.3
??
生成代理證書
運行
grid-proxy-init
獲得用戶的代理證書:
%GLOBUS_LOCATION\bin\grid-proxy-init
這樣可以在指定位置生成代理證書。通常這樣生成的代理證書只有
12
小時的有效期。為了方便開發,可以加入
-hours
參數為代理證書指定一個相對比較長的有效期。
如果沒有代理證書,就會拋出如下異常:
Exception in thread "main" org.globus.gsi.GlobusCredentialException: Proxy file (C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\x509up_u_administrator) not found.
??? at org.globus.gsi.GlobusCredential.<init>(GlobusCredential.java:98)
?????? at org.globus.gsi.GlobusCredential.getDefaultCredential(GlobusCredential.java:526)
3??????
配置域名
由于在證書中使用了域名,如果此時域名服務器無法對服務器的
IP
地址進行解析,需要修改
hosts
文件來指定域名。
否則,會拋出類似如下的異常:
[main] ERROR delegation.DelegationUtil? -
org.globus.common.ChainedIOException
: Authentication failed [Caused by: Operation unauthorized (Mechanism level: Authorization failed. Expected "/CN=host/192.168.1.129" target but received "/O=Grid/OU=GlobusTest/OU=simpleCA-mci.uestc.edu.cn/CN=host/mci.uestc.edu.cn")]
Exception in thread "main" . Caused by AxisFault
?faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.userException
?faultSubcode:
?faultString:
org.globus.common.ChainedIOException
: Authentication failed [Caused by: Operation unauthorized (Mechanism level: Authorization failed. Expected "/CN=host/192.168.1.129" target but received "/O=Grid/OU=GlobusTest/OU=simpleCA-mci.uestc.edu.cn/CN=host/mci.uestc.edu.cn")]
?faultActor:
?faultNode:
?faultDetail:
??? {http://xml.apache.org/axis/}stackTrace:Authentication failed. Caused by
GSSException
: Operation unauthorized (Mechanism level: Authorization failed. Expected "/CN=host/192.168.1.129" target but received "/O=Grid/OU=GlobusTest/OU=simpleCA-mci.uestc.edu.cn/CN=host/mci.uestc.edu.cn")
4??????
配置
Eclipse
為了使程序可以正常執行,還需要對
Eclipse
工程進行配置。
4.1
??
指定
client-config.wsdd
在
Eclipse
工程的虛擬機參數中加入
-Daxis.ClientConfigFile=share\client-config.wsdd
來指定
client-config.wsdd
文件。可以從
Linux
上拷貝
$GLOBUS_LOCATION\client-config.wsdd
得到。
否則,會拋出如下異常:
[main] ERROR delegation.DelegationUtil? - No client transport named 'https' found!
Exception in thread "main" . Caused by AxisFault
?faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
?faultSubcode:
?faultString: No client transport named 'https' found!
?faultActor:
?faultNode:
?faultDetail:
??? {http://xml.apache.org/axis/}stackTrace:No client transport named 'https' found!
4.2
??
指定
ws-core
安裝路徑
在
Eclipse
工程的虛擬機參數中加入
-DGLOBUS_LOCATION=%GLOBUS_LOCATION
指定
Windows
中
ws-core
的安裝路徑。
否則,可能拋出如下異常:
Exception in thread "main" Container failed to initialize. Caused by
org.apache.axis.ConfigurationException
: Configuration file directory '.\etc' does not exist or is not a directory or is not readable.
org.apache.axis.ConfigurationException
: Configuration file directory '.\etc' does not exist or is not a directory or is not readable.
5??????
總結
以上是在
Windows
平臺下基于
Web
服務開發
Globus
應用時遇到的問題以及解決辦法。
posted on 2006-12-12 22:19
思考 閱讀(2785)
評論(1) 編輯 收藏 所屬分類:
Grid Computing