部署在weblogic上的web應用需要訪問zookeer服務,從中獲取信息。但是訪問過程中總是報錯如下錯誤:
26 nov. 2012 12:17:29,250 WARN : Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.lang.IllegalArgumentException: No Configuration was registered that can handle the configuration named Client at com.bea.common.security.jdkutils.JAASConfiguration.getAppConfigurationEntry(JAASConfiguration.java:124)
通過搜索,找到問題所在,主要原因是weblogic拋出的異常,zookeeper不能接收到,所以需要將捕獲的異常改爲zk能捕獲到的異常,即:RuntimeException。具體分析參考如下網址:
1.http://qnalist.com/questions/440202/disabling-sasl
2.https://gist.github.com/barkbay/4153107
接下來的問題,就是修改zookeeper源碼,然後編譯。
此處使用eclipse自帶的ant工具進行編譯:
1、首先從ANT官網http://ant.apache.org/下載ANT
2、配置環境變量: ANT_HOME: C:\apache-ant-1.9.4;PATH:%ANT_HOME%\bin
3、測試ANT安裝是否成功。在cmd窗口下運行ant,如果出現如下信息,則表示ant安裝成功
Buildfile:build.xml does not exist!
Build failed
4、下載zookeeper源碼,進入到build.xml目錄下,使用命令ant eclipse 自動構建eclipse工程
5、將生成的工程導入到eclipse
6、修改zk,並編譯。具體操作請參照下圖:
正常情況下編譯無問題,若遇問題,可參考網址:
1、http://www.myexception.cn/eclipse/1616862.html
2、http://blog.csdn.net/vah101/article/details/24378575