出发点: 我不赞同手机应用会走PC机基于浏览器的路线,手机基于html5可以实现很多Web APP,但是一般还是以WebView方式去实现一个应用并以一个图标作为入口而不是通过输入网址,所以手机应用很方面潜入IM功能获取到实时的交互信息。
实践过程: XMPP服务器端采用开源的openfire+sqlserver 2005, 手机端Android基于asmack库,ios基于object-c的xmpp库实现。
1. 解决数据库无法访问的问题
java.sql.SQLException: Network error IOException: Connection refused: connect
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:385)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.logicalcobwebs.proxool.DefaultConnectionBuilder.buildConnection(DefaultConnectionBuilder.java:39)
at org.logicalcobwebs.proxool.Prototyper.buildConnection(Prototyper.java:159)
at org.logicalcobwebs.proxool.Prototyper.sweep(Prototyper.java:102)
at org.logicalcobwebs.proxool.PrototyperThread.run(PrototyperThread.java:44)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:304)
at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:255)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:310)
... 8 more
解决方法: 1. 打开 /Microsoft SQL Server 2005/配置工具/目录下的SQL Server Configuration Manager,选择mssqlserver协议,
2. cmd >net start mssqlserver
3.在openfire启动后的Launch Admin设置数据库的链接字符串(此时不需要指定端口号了)
JDBC驱动程序类:net.sourceforge.jtds.jdbc.Driver
数据库URL: jdbc:jtds:sqlserver://dell/openfire;appName=jive
2. 解决XMPP客户端asmack库中传文件失败的问题