centos 系統安裝官方文檔:http://thrift.apache.org/docs/install/centospython
1、按該文檔安裝出現了一系列的問題,記錄以下:git
# wget http://www.monkey.org/~provos/libevent-1.2.tar.gz # tar zxvf libevent-1.2.tar.gz # cd libevent-1.2 # ./configure –prefix=/usr # make # make install
2.安裝thrift到make步驟時出現以下錯誤:apache
g++: error: /usr/lib64/libboost_unit_test_framework.a: No such file or directorybootstrap
3.../../../lib/cpp/.libs/libthriftnb.so: undefined reference to `evutil_make_socket_closeonexec'centos
../../../lib/cpp/.libs/libthriftnb.so: undefined reference to `evbuffer_get_length'app
../../../lib/cpp/.libs/libthriftnb.so: undefined reference to `evbuffer_pullup'框架
collect2: error: ld returned 1 exit statussocket
4.automake --add-missing」時出錯及解決辦法:ui
AC_INIT AM_INIT_AUTOMAKE dnl add this AC_PROG_CXX AC_PROG_LIBTOOL
本人安裝thrift遇到了各類各樣的坑,真是一波三折,差點放棄,但願thrift能把安裝過程完善一下,讓使用者投入更多的時間在使用上而不是安裝上。this
2、Thrift python使用過程遇到的錯誤:
No handlers could be found for logger "thrift.server.TServer"
參考網址:http://blog.csdn.net/mantoureganmian/article/details/48340215
thrift框架作的很好,封裝的也很好,不單單有代碼生成功能,並且還有錯誤處理機制。這種錯誤處理機制處理過程是:當Handler類中的出現錯誤時,一概提示:「No handlers could be found for logger "thrift.server.TServer"」。換句話說,當變量拼寫錯誤時,不會提示某個變量未命名,而提示「No handlers could be found for logger "thrift.server.TServer"」,這樣無疑增長了改錯難度,坑啊!!!
對於此,比較好的解決方案是:使用try....except Exception as e:模塊來手動打印錯誤。try模塊代碼示例以下:
try: a=b except Exception as e: print e
我代碼出錯的緣由是:server端返回給了client端字符串爲漢字,改爲拼音問題解決。
thrift總體來講仍是很好用的,特別是支持跨多種語言,減小了開發者間的通訊難度。
本人菜鳥一枚,但不會在菜鳥的路上越走越遠,thrift遇到問題還會持續更新。。。