天天看點

【tigase】用Eclipse調試tigase源碼

我們項目開始時候由于各種原因選擇openfire作為即時通訊伺服器。随着使用者人數的增加,考慮到openfrie叢集需要license, 而單台openfire在穩定性及容量上都難以為繼。需要考慮一個支援叢集的xmpp伺服器。由于語言的問題,畢竟現在用的是java,是以先考察一下Tigase

tigase官網兩條新聞很醒目:

  • Cluster with over 1mln online users.
  • 500k online users on a single machine.

呵呵,很吸引人,下載下傳了tigase-server-5.1.0-b2512-beta1.jar 和 tigase-server-5.1.0-b2512-beta1.exe在本地都沒完全安裝成功。唉。。。

隻好check out 源碼: https://svn.tigase.org/reps/tigase-server/trunk

按照 Manual installation in consolemode 

Pastedfrom <http://www.tigase.org/content/manual-installation-console-mode> 

的方式在伺服器安裝成功,spack順利連接配接,聊天。

好,在本地将源碼導入eclipse,因為支援maven,導入很順利。但要進一步開發,需要和現有系統內建,必然需要能夠對工程進行修改調試,如何debug呢

官網上搜尋一下,發現有一篇文章:

Hack Tigase Jabber/XMPP Serverin Eclipse 

Pastedfrom <http://www.tigase.org/content/hack-tigase-jabberxmpp-server-eclipse#comment-2524> 

文章沒多大作用,但文章後面的一條評論卻提供了一個有效的方法, 如下:

I have been doing some Tigase

Submitted by Shawn Clark (not verified) on Mon, 2010-04-12 17:44.

I have been doing some Tigase development within Eclipse and have the server able to be run and debugged from within it. The setup I am using is to have the main src code from Tigase in one project and then setup a second project that I call tigase-local. This project just contains the configuration files and maven dependency to the main Tigase project.

Once that is setup then I was able to figure out what flags were needed by looking at the scripts/tigase.sh file along with the etc/tigase.conf file. In your run configuration you should have the following settings:

Main Class: tigase.server.XMPPServer

Program arguments: --property-file etc/init.properties

VM arguments:

-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8

-Djdbc.drivers=com.mysql.jdbc.Driver:org.postgresql.Driver:org.apache.derby.jdbc.EmbeddedDriver

-server -Xms100M -Xmx200M -XX:PermSize=32m -XX:MaxPermSize=256m -XX:MaxDirectMemorySize=128m

You will want to change the jdbc.drivers to contain the drivers you need to connect to your database backend.

That should be it and you then can run / debug the Tigase server itself.

這條消息裡面沒有細說都要什麼配置檔案,經過試驗需要以下檔案:

certs

我全拷貝過來了,不然報SSL空指針

etc

      cross-domain-policy.xml 和init.properties

libs

      jdbc-mysql.jar

可以放斷點調試跟蹤了。