隨筆-49  評(píng)論-67  文章-27  trackbacks-0

          1?????? 目的

          在進(jìn)行 Globus 項(xiàng)目開發(fā)的過程中,需要在 Windows 下通過 Web 服務(wù)調(diào)用 Globus 的服務(wù)(如 RFT )。但是在編寫程序的時(shí)候遇到了一系列的問題。幾經(jīng)周折,終于搞定。遂將解決方法總計(jì)如下,以供大家參考。

          2?????? 證書問題

          由于 Globus 的安全問題,需要使用證書才能訪問服務(wù)。這里,有三種證書,分別是 CA 證書、用戶證書和代理證書。我們可以從以及安裝好 Globus Linux 主機(jī)上將用戶證書(連同用戶的私鑰)和 CA 證書一同拷貝到 Windows 上使用。

          用戶證書和用戶私鑰通常位于用戶根目錄中:

          $HOME\.globus\usercert.pem

          $HOME\.globus\userkey.pem

          用戶證書和用戶私鑰用來生成代理證書。

          CA 證書在校驗(yàn)用戶證書的有效性時(shí)使用,位于

          /etc/grid-security/certificates/a3989c00.0

          代理證書是訪問 Globus 服務(wù)時(shí)實(shí)際使用的證書,它可以通過上面的證書來生成。但是生成代理證書需要進(jìn)行如下操作。

          2.1 ?? 安裝 ws-core

          設(shè)置環(huán)境變量 GLOBUS_LOCATION

          set %GLOBUS_LOCATION%=some_where_ws-core_installed

          下載 ws-core-4.0.1-bin.zip (這里面的版本由需要決定)文件,解壓到 %GLOBUS_LOCATION 目錄下。

          2.2 ?? 安裝 cog-jglobus

          設(shè)置環(huán)境變量 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 目錄。

          運(yùn)行:

          %COG_INSTALL_PATH\bin\setup

          根據(jù)提示,指定用戶證書、私鑰, CA 證書以及代理證書的位置。

          成功安裝后,會(huì)在 Windows 用戶根目錄下生成 .globus 目錄,并在該目錄下建立一個(gè) cog.properties 文件。該文件內(nèi)容大致如下:

          #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 會(huì)根據(jù)這個(gè)文件來查找和生成證書。

          如果沒有正確設(shè)置 cog.properties 文件,會(huì)產(chǎn)生如下異常:

          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 ?? 生成代理證書

          運(yùn)行 grid-proxy-init 獲得用戶的代理證書:

          %GLOBUS_LOCATION\bin\grid-proxy-init

          這樣可以在指定位置生成代理證書。通常這樣生成的代理證書只有 12 小時(shí)的有效期。為了方便開發(fā),可以加入 -hours 參數(shù)為代理證書指定一個(gè)相對(duì)比較長(zhǎng)的有效期。

          如果沒有代理證書,就會(huì)拋出如下異常:

          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?????? 配置域名

          由于在證書中使用了域名,如果此時(shí)域名服務(wù)器無法對(duì)服務(wù)器的 IP 地址進(jìn)行解析,需要修改 hosts 文件來指定域名。

          否則,會(huì)拋出類似如下的異常:

          [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 &quot;/CN=host/192.168.1.129&quot; target but received &quot;/O=Grid/OU=GlobusTest/OU=simpleCA-mci.uestc.edu.cn/CN=host/mci.uestc.edu.cn&quot;)]

          ?faultActor:

          ?faultNode:

          ?faultDetail:

          ??? {http://xml.apache.org/axis/}stackTrace:Authentication failed. Caused by GSSException : Operation unauthorized (Mechanism level: Authorization failed. Expected &quot;/CN=host/192.168.1.129&quot; target but received &quot;/O=Grid/OU=GlobusTest/OU=simpleCA-mci.uestc.edu.cn/CN=host/mci.uestc.edu.cn&quot;)

          4?????? 配置 Eclipse

          為了使程序可以正常執(zhí)行,還需要對(duì) Eclipse 工程進(jìn)行配置。

          4.1 ?? 指定 client-config.wsdd

          Eclipse 工程的虛擬機(jī)參數(shù)中加入 -Daxis.ClientConfigFile=share\client-config.wsdd 來指定 client-config.wsdd 文件。可以從 Linux 上拷貝 $GLOBUS_LOCATION\client-config.wsdd 得到。

          否則,會(huì)拋出如下異常:

          [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 工程的虛擬機(jī)參數(shù)中加入 -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?????? 總結(jié)

          以上是在 Windows 平臺(tái)下基于 Web 服務(wù)開發(fā) Globus 應(yīng)用時(shí)遇到的問題以及解決辦法。

          posted on 2006-12-12 22:19 思考 閱讀(2788) 評(píng)論(1)  編輯  收藏 所屬分類: Grid Computing

          評(píng)論:
          # re: Windows平臺(tái)下基于Web服務(wù)開發(fā)Globus應(yīng)用[未登錄] 2007-07-25 13:52 | 飛馬
          我也想在Windows 下通過 Web 服務(wù)調(diào)用 Globus 的服務(wù)(如 GRAM、RFT等),你本文沒有提到如何具體編程調(diào)用RFT,能否公開一下,謝謝
          我的msn:flyhorse2k@hotmail.com
          希望能得到你的指導(dǎo)。  回復(fù)  更多評(píng)論
            

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 张北县| 方正县| 佳木斯市| 城固县| 都匀市| 陈巴尔虎旗| 叶城县| 任丘市| 南江县| 金塔县| 昌平区| 通河县| 晋城| 富蕴县| 莫力| 石阡县| 临沧市| 九龙县| 中牟县| 渑池县| 平湖市| 新竹县| 遵义县| 宁阳县| 文化| 布拖县| 鄂托克前旗| 屯留县| 兴仁县| 东港市| 炉霍县| 肥乡县| 无为县| 永登县| 襄垣县| 余姚市| 云和县| 湖州市| 上犹县| 南昌市| 拜泉县|