`

Openfire+Spark安装手册

 
阅读更多

Openfire+Spark安装手册

王保政

QQ:29803446

Msn:baozhengw999@hotmail.com

关键字:快速开发平台 openjweb 增删改查 即时通信

2009-8-29

<!--[if supportFields]><span lang=EN-US style='mso-bidi-font-size:10.5pt'><span style='mso-element:field-begin'></span><span style='mso-spacerun:yes'>&nbsp;</span>TOC /o &quot;1-3&quot; /h /z /u <span style='mso-element:field-separator'></span></span><![endif]-->第一章 Java领域的IM解决方案.... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321433 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->2<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400330033000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

第二章 安装openfire3.6.4. <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321434 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->3<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400330034000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

2.1 配置机器的域名... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321435 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->3<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400330035000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

2.2 安装openfire. <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321436 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->3<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400330036000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

2.2.1 安装... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321437 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->3<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400330037000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

2.2.2 运行数据库脚本... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321438 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->4<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400330038000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

2.2.3 数据库驱动jar... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321439 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->6<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400330039000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

2.2.4 openfire初始化配置... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321440 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->6<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340030000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

2.3 设置用户... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321441 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->12<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340031000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

第三章 安装spark客户端.... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321442 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->13<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340032000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

第四章 配置msn网关.... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321443 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->15<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340033000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

4.1 服务端配置msn网关... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321444 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->15<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340034000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

第五章 Red5视频配置.... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321445 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->18<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340035000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

5.1 部署red5.war. <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321446 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->18<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340036000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

5.2 spark客户端配置视频插件... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321447 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->19<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340037000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

第六章 使用smack开发即时通信功能.... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321448 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->22<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400340038000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->

<!--[if supportFields]><span lang=EN-US style='mso-bidi-font-size:10.5pt'><span style='mso-element:field-end'></span></span><![endif]-->


<!--[if !supportLists]-->第一章 <!--[endif]-->Java领域的IM解决方案

Java领域的即时通信的解决方案可以考虑openfire+spark+smack。当然也有其他的选择。

Openfire是基于Jabber协议(XMPP)实现的即时通信服务器端版本,目前建议使用3.6.4版本,这个版本是当前最新的版本,而且网上可以找到下载的源代码。

即时通信客户端可使用spark2.5.8,这个版本是目前最新的release版本,经过测试发现上一版本在视频支持,msn网关支持上可能有问题,所以选择openfire3.6.4+spark2.5.8是最合适的选择。

Smack是即时通信客户端编程库,目前我已测通通过jsp使用smackAPIopenfire注册用户发送消息,并且可以通过监听器获得此用户的应答消息。

通过smackmsn用户和QQ用户,gtalk用户发送消息应该也可以实现,关于向gtalk用户发送消息的例子较多。这个留待以后研究。至少目前可以通过程序向spark发消息了。对于局域网内部应用足以解决系统与用户交互的问题,甚至可以做自动应答机器人。

Spark支持聊天,语音,视频,会议,文件收发,截屏,连接msn等功能。

第二章 安装openfire3.6.4

2.1 配置机器的域名

使用openfire需要配置机器的域名。如果局域网内没有安装域服务器,则需要手工为机器配置域名,打开C:/WINDOWS/system32/drivers/etc/hosts文件,增加一新行:

<!--[if !supportLists]-->127.0.0.1 <!--[endif]-->bzwang.tzsoft.com (用户根据自己的需要可配置称别的名字,但最好符合带.的域名格式)

其他机器使用域名访问openfire,也需要在C:/WINDOWS/system32/drivers/etc/hosts中指定bzwang.tzsoft.com对应的ip地址,假设安装openfire的主机IP192.168.1.10,hosts文件中应增加一新行:

192.168.1.10 bzwang.tzsoft.com

通过这种方式指定主机域名,建议安装openfire的机器配置静态ip地址以免ip发生改变。

2.2 安装openfire

2.2.1 安装

安装程序为openfire_3_6_4.exe,运行后,语言选择简体中文,见下图:

<!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter" /> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0" /> <v:f eqn="sum @0 1 0" /> <v:f eqn="sum 0 0 @1" /> <v:f eqn="prod @2 1 2" /> <v:f eqn="prod @3 21600 pixelWidth" /> <v:f eqn="prod @3 21600 pixelHeight" /> <v:f eqn="sum @0 0 1" /> <v:f eqn="prod @6 1 2" /> <v:f eqn="prod @7 21600 pixelWidth" /> <v:f eqn="sum @8 21600 0" /> <v:f eqn="prod @7 21600 pixelHeight" /> <v:f eqn="sum @10 21600 0" /> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" /> <o:lock v:ext="edit" aspectratio="t" /> </v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style='width:261pt; height:101.25pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image001.jpg" o:title="1" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

后续按照提示安装,最后出现下面的界面:

<!--[if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" style='width:373.5pt;height:291.75pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image002.jpg" o:title="2" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

这时先不要运行openfire,所以不要勾选上面页面的复选框,然后点完成,如果勾选的话,在新出现的窗口中点“stop”停止openfire后续的运行,然会点”quit”退出,因为下面要配置openfire使用的数据库,需要手工将数据库驱动放到openfire的某个目录下,否则openfire不识别数据库驱动的包名。

2.2.2 运行数据库脚本

数据库运行脚本在C:/Program Files/Openfire/resources/database目录下,如果用户安装选择的不是C:/Program Files目录,可以到安装openfire目录下找到database目录,打开此目录后可看到有多种版本的数据库脚本,假定我们现在要把openfire的数据库安装在sqlserver2005中,则使用openfire_sqlserver.sql脚本,假如已经装好了2005数据库,可在Management Studio中执行数据库脚本,见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1027" type="#_x0000_t75" style='width:415.5pt;height:279.75pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image003.jpg" o:title="3" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

执行后,打开数据库,可看到下面创建的数据库表:

<!--[if gte vml 1]><v:shape id="_x0000_i1028" type="#_x0000_t75" style='width:243pt;height:445.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image005.jpg" o:title="4" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

2.2.3 数据库驱动jar

如果使用sqlserver2005,则将sqlserver2005驱动jarsqljdbc.jar复制到C:/Program Files/Openfire/lib下,使用openjweb快速开发平台的用户可直接从D:/project/apache-tomcat-5.5.27/common/lib找到此jar包复制过去,另外此目录还有mysqlmysql-connector-java-3.1.12-bin.jaroracleojdbc14.jar,如果用户不选择sqlserver则复制对应数据库的驱动jar包。

2.2.4 openfire初始化配置

从开始菜单中找到openfire并运行,下面是运行界面:

<!--[if gte vml 1]><v:shape id="_x0000_i1029" type="#_x0000_t75" style='width:300pt;height:223.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image006.jpg" o:title="5" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

”Launch Admin”,出现下面的页面,页面连接为http://127.0.0.1:9090/setup/index.jsp

<!--[if gte vml 1]><v:shape id="_x0000_i1030" type="#_x0000_t75" style='width:414.75pt;height:255pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image007.jpg" o:title="6" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

语种选择中文(简体),点”Continue”:(下面的页面如果出现英文,请刷新一下页面或者重新点Launch Admin

<!--[if gte vml 1]><v:shape id="_x0000_i1031" type="#_x0000_t75" style='width:414.75pt;height:204pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image009.jpg" o:title="7" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

这个页面的Domain默认为机器名,请改为一开始设置的域名,例如bzwang.tzsoft.com,就是将图中的Domain中的文字换成bzwang.tzsoft.com后,点Continue(继续):

<!--[if gte vml 1]><v:shape id="_x0000_i1032" type="#_x0000_t75" style='width:415.5pt;height:205.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image011.jpg" o:title="8" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

这个页面中第一个选项,即标准数据库连接,不要选择嵌入的数据库(Embedded Database,嵌入的数据库是hsqldb数据库,生产环境不要选择此选项),然后点继续”:

这个页面是配置是否使用LDAP,我们现在不配置LDAP,所以选择 Default默认即可,点继续:

<!--[if gte vml 1]><v:shape id="_x0000_i1033" type="#_x0000_t75" style='width:414.75pt;height:240pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image013.jpg" o:title="9" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

上图是sqlserver2005的配置,jdbc驱动类为: com.microsoft.sqlserver.jdbc.SQLServerDriver

数据库URL为:

jdbc:sqlserver://192.168.1.222:2324;DatabaseName=dms

数据库名和用户名及口令请根据实际环境配置。

配置完成后,点继续”:

如果点继续出现错误提示页面,请检查

<!--[if !supportLists]-->(1) <!--[endif]-->数据库表是否按前面的步骤已在数据库中创建

<!--[if !supportLists]-->(2) <!--[endif]-->是否已将对应的数据库jar保复制到openfirelib目录

<!--[if !supportLists]-->(3) <!--[endif]-->检查数据库连接参数,端口,数据库名等属性,可使用dos命令行检查数据库端口是否有效,例如telnet 192.168.1.222 2324

下面是配置LDAP的页面,选择初始设置”(默认选项)即可。

<!--[if gte vml 1]><v:shape id="_x0000_i1034" type="#_x0000_t75" style='width:414.75pt;height:207.75pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image015.jpg" o:title="10" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

点“继续”:

下面是配置超级管理员的页面:

<!--[if gte vml 1]><v:shape id="_x0000_i1035" type="#_x0000_t75" style='width:415.5pt;height:202.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image017.jpg" o:title="11" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

输入一个邮箱和口令,例如123456

设置好后点“继续”:

<!--[if gte vml 1]><v:shape id="_x0000_i1036" type="#_x0000_t75" style='width:414.75pt;height:169.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image019.jpg" o:title="12" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

这个时候不要点“登录到管理控制台”,登录肯定失败,需要切换到这个页面:

<!--[if gte vml 1]><v:shape id="_x0000_i1037" type="#_x0000_t75" style='width:300pt;height:223.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image006.jpg" o:title="5" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

”stop”,然后点“start,等重启动成功后点”Launch Admin”,进入登录页面:

<!--[if gte vml 1]><v:shape id="_x0000_i1038" type="#_x0000_t75" style='width:327pt;height:154.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image021.jpg" o:title="13" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

使用admin 用户名和设置的口令123456登录,下面是登录成功的页面,恭喜!sqlserver2005上安装openfire成功!

<!--[if gte vml 1]><v:shape id="_x0000_i1039" type="#_x0000_t75" style='width:414.75pt;height:237pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image022.jpg" o:title="14" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

我们打开ofUser数据库表可以看到admin用户信息:(下面的口令不是用md5加密的)

<!--[if gte vml 1]><v:shape id="_x0000_i1040" type="#_x0000_t75" style='width:414.75pt;height:54pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image024.jpg" o:title="15" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

2.3 设置用户

在登录成功页面点“用户/组”标签维护用户信息,可在这里增加新的用户,也可以建组,下面是新建的几个组:

<!--[if gte vml 1]><v:shape id="_x0000_i1041" type="#_x0000_t75" style='width:414.75pt;height:147pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image026.jpg" o:title="16" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

下面新建几个测试用户,分别是abao/abao,zhangyu/zhangyu,suqi/suqi,liu/liu

<!--[if gte vml 1]><v:shape id="_x0000_i1042" type="#_x0000_t75" style='width:414.75pt;height:209.25pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image028.jpg" o:title="17" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

说明:当安装了spark客户端后,用户可直接在客户端注册帐号。

<!--[if !supportLists]-->第三章 <!--[endif]-->安装spark客户端

安装程序为spark_2_5_8.exe,安装过程全部默认即可。

下面是登录界面:

<!--[if gte vml 1]><v:shape id="_x0000_i1043" type="#_x0000_t75" style='width:192pt;height:317.25pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image030.jpg" o:title="18" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

登录时可使用openfire中创建的帐号,也可以点(A)帐户自己注册新的帐号,服务器需设置为openfire的域名地址即上面安装的bzwang.tzsoft.com,下面是登录成功界面:

<!--[if gte vml 1]><v:shape id="_x0000_i1044" type="#_x0000_t75" style='width:231pt;height:392.25pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image031.jpg" o:title="19" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

关于spark客户端的具体功能就不介绍了,下面介绍openfire配置msn网关及spark如何连接msn,以及red5视频的配置方式。

<!--[if !supportLists]-->第四章 <!--[endif]-->配置msn网关

4.1 服务端配置msn网关

gateway.jar插件包(可网上下载)复制到openfireplugin目录下,如:

C:/Program Files/Openfire/plugins,如果openfire安装到别的目录请找到对应的目录,把gateway.jar复制过去。停止openfire,重新启动并登录后,见下面的页面,多出了一个gateways的标签页:

<!--[if gte vml 1]><v:shape id="_x0000_i1045" type="#_x0000_t75" style='width:414.75pt;height:257.25pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image032.jpg" o:title="20" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

Gateways,找到MSN Messagers,勾选,然后点“选项”,见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1046" type="#_x0000_t75" style='width:414.75pt;height:343.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image034.jpg" o:title="21" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

以上默认的配置不用修改,点“测试”,显示:

<!--[if gte vml 1]><v:shape id="_x0000_i1047" type="#_x0000_t75" style='width:414pt;height:115.5pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image036.jpg" o:title="22" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

点“测试连接”,显示测试成功。(右侧将显示绿色背景的文字提示测试成功)

4.2 spark客户端设置msn帐号:

启动spark,登录后,spark窗口的右上多出一个灰色的蝴蝶,见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1048" type="#_x0000_t75" style='width:221.25pt;height:65.25pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image037.jpg" o:title="23" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

点这个蝴蝶,然后选择“输入登入资讯”,显示下面的窗口:

<!--[if gte vml 1]><v:shape id="_x0000_i1049" type="#_x0000_t75" style='width:297.75pt;height:150.75pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image038.jpg" o:title="24" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

在这里输入msn的用户和口令,然后保存,稍后片刻,spark将从msn上获取用户列表,最后显示下面的msn好友列表:

<!--[if gte vml 1]><v:shape id="_x0000_i1050" type="#_x0000_t75" style='width:231pt;height:387pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image039.jpg" o:title="25" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

这时可以选择一个在线用户聊天了,spark还支持文件传输,截屏,语音,视频等。

<!--[if !supportLists]-->第五章 <!--[endif]-->Red5视频配置

5.1 部署red5.war

red5.war复制到C:/Program Files/Openfire/plugins,如果openfire是在运行状态,一会会在这个目录下自动部署red5.war(在此目录下自动生成red5目录)。安装成功后,openfire的管理页面会多出一个red5标签,见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1051" type="#_x0000_t75" style='width:415.5pt;height:99pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image040.jpg" o:title="26" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

服务端不需要做任何改动。

5.2 spark客户端配置视频插件

上一步骤部署了red5后,需要停止openfire并重新启动,启动完成后,访问http://bzwang.tzsoft.com:7070/red5,显示一个red5html首页,下拉到页面最下面,找到spark plugin,”here”,见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1052" type="#_x0000_t75" style='width:390.75pt;height:96pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image041.jpg" o:title="27" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

here会下载red5-plugin.jar,直接保存在C:/Program Files/Spark/plugins目录下,重新启动spark

spark中右键点一个人,会出现几个菜单:

<!--[if gte vml 1]><v:shape id="_x0000_i1053" type="#_x0000_t75" style='width:141pt;height:219.75pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image042.jpg" o:title="28" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

其中View Destop ScreenPublish Desktop Screen是相关联的,见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1054" type="#_x0000_t75" style='width:253.5pt;height:119.25pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image043.jpg" o:title="29" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

如果A用户用Publish Desktop Screen发布了自己的桌面,B用户选择A用户,右键选择上一个图中的View Desktop Screen,B用户可看到A用户的计算机桌面。在http://bzwang.tzsoft.com:7070/red5页面上有一个功能和这个类似,见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1055" type="#_x0000_t75" style='width:327.75pt;height:102.75pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image044.jpg" o:title="30" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

To publish是发布自己的桌面,To Viewer是别人观看自己发布的桌面,多人发布是什么效果没有具体测试。可以自己发布然后观看自己的桌面(效果有点像两个镜子对照,会出现层层窗口嵌套的现象),下面是自己发布自己的桌面并观看自己的桌面的效果:

<!--[if gte vml 1]><v:shape id="_x0000_i1056" type="#_x0000_t75" style='width:414.75pt;height:312.75pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image045.jpg" o:title="31" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

当选择一个人,右键选择Add/Remove Video Roster后,可进行 视频聊天,可以加多个人进行视频,每选择一个热人,然后点Add/Remove Video Roster,就可以将这个人加入到视频中或者从视频中移除,下面是视频页面(我没装摄像头),可以看出一个页面中可以显示多人视频,如果其他人也装了spark,估计也能看到多人视频的效果(猜测,没有测试),见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1057" type="#_x0000_t75" style='width:261pt;height:312pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image047.jpg" o:title="32" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

<!--[if !supportLists]-->第六章 <!--[endif]-->使用smack开发即时通信功能

可以使用smack开源产品开发与即时通信用户交互的功能,这样我们可以使用系统来模拟一个openfire的用户来向其他用户发送消息,因而可以使应用系统产生的业务消息实时传递给即时通信用户,例如系统向某用户发送“有新的请假单需要您审批”,如果用户开启了spark客户端,则spark客户端会实时接收此消息。

Smack可从网上下载,目前最新版本为smack_3_1_0.zip,将此文件里四个smack开头的jar包放到自己的WEB应用的WEB-INF/lib目录,使用下面的jsp文件进行测试:

下面是测试向spark用户suqi发送消息的页面代码:

<%@ page contentType="text/html;charset=UTF-8"%>

<%@ page import="org.jivesoftware.smack.*"%>

<%@ page import="org.jivesoftware.smack.packet.*"%>

<%

//以下可以通过程序向spark帐号发信息,但没有测通想msn帐号发信息

XMPPConnection connection = new XMPPConnection("bzwang.tzsoft.com"); //openfire服务器的主机域名

// ConnectionConfiguration connectionConfig = new ConnectionConfiguration( "messenger.hotmail.com",1863,"messenger.hotmail.com");

// XMPPConnection connection = new XMPPConnection(connectionConfig);

connection.connect();//先连接服务器

try

{

connection.login("abao", "abao");//使用openfire的注册用户登录openfire服务器

System.out.println("登录成功!");

//createChat的第一个参数一定要带域名(suqi@bzwang.tzsoft.com),否则会话失败

Chat chat = connection.getChatManager().createChat("suqi@bzwang.tzsoft.com", new MessageListener()

//Chat chat = connection.getChatManager().createChat("baozhengw9999%hotmail.com@msn.bzwang.cmissoft.com", new MessageListener()

{

public void processMessage(Chat chat, Message message)

{

//如果不用connection.disconnect()断开连接,这里可以监听回复信息

System.out.println("Received message: " + message.getBody());

}

}

);

System.out.println("发送消息....");

chat.sendMessage("请问你收到我的消息了吗?");//

/* Message message = new Message("baozhengw9999%hotmail.com@msn.bzwang.cmissoft.com");

message.setBody("你好!我是个聊天机器人!");

connection.sendPacket(message);

*/

System.out.println("发送完毕...");

connection.disconnect();

} catch (Exception ex) {

System.out.println("login error");

}

%>

发送成功后,如果suqi用户打开了spark,spark会闪烁提示有新消息,打开spark,聊天窗口显示系统用abao用户发送的消息,见下图:

<!--[if gte vml 1]><v:shape id="_x0000_i1058" type="#_x0000_t75" style='width:414.75pt;height:105.75pt'> <v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image048.jpg" o:title="33" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

这样实现了业务系统和即时通信的无缝整合,以后应该还可以实现通过smack编程使内网的openfire注册用户向自己的msn好友或QQ好友发送消息以及接收消息。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics