XMPP,Smack,Openfire 异常、问题总结

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/w690333243/article/details/79969088

一、Smack 4.2.3,入群时总是报无响应,还未找到原因(源码问题),已找到原因,openfire4.2.0+版本自身bug,不支持用户110状态

Exception=org.jivesoftware.smack.SmackException$NoResponseException: 
No response received within reply timeout. Timeout was 10000ms (~10s).
Waited for response using: AndFilter: (StanzaTypeFilter: Presence,
OrFilter: (AndFilter: (FromMatchesFilter (ignoreResourcepart): 
100001_ir1jbcntb@conference.192.168.1.102,
MUCUserStatusCodeFilter: status=110), AndFilter: 
(FromMatchesFilter (full): 100001_ir1jbcntb@conference.192.168.1.102/100004, 
StanzaIdFilter: id=ovR90-45, PresenceTypeFilter: type=error)))

二、加入聊天室时报错:原因,房间设置了只允许成员加入,当前账号非加入房间的成员,故报错

org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPP error reply received from 
09agyrmgm@conference.localhost/哦哦等等: XMPPError: registration-required - auth

http://web.mit.edu/svalente/lib/smack_3_0_4/javadoc/org/jivesoftware/smack/packet/XMPPError.html

三、Openfire4.2.0+
发扩展消息时,message.addExtension,对方无法收到消息,Openfire4.1.6-正常,Openfire自身bug

四、AccountManager.getInstance(this.getXMPPConnection()).getAccountAttribute(“name”);无响应

04-21 11:36:16.788 14572-14640/com.xx W/System.err: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 10000ms (~10s). Waited for response using: StanzaIdFilter: id=nMrxy-57.
04-21 11:36:16.788 14572-14654/com.xx W/art: Long monitor contention with owner Thread-4 (14640) at void java.lang.Object.wait!(long, int)(Object.java:-2) waiters=0 in void org.jivesoftware.smackx.iqregister.AccountManager.getRegistrationInfo() for 9.936s
04-21 11:36:16.788 14572-14640/com.xx W/System.err:     at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:260)
04-21 11:36:16.788 14572-14640/com.xx W/System.err:     at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:214)
04-21 11:36:16.789 14572-14640/com.xx W/System.err:     at org.jivesoftware.smackx.iqregister.AccountManager.getRegistrationInfo(AccountManager.java:370)
04-21 11:36:16.789 14572-14640/com.xx W/System.err:     at org.jivesoftware.smackx.iqregister.AccountManager.getAccountAttribute(AccountManager.java:210)

解决找了个简单的demo,使用同样的版本,在代码中登录后加入获取name的这行代码,发现没有问题。很是奇怪,是自己写代码写的有问题?于是各种尝试,先是修改Smack版本,无果。最后修改
AccountManager.getInstance(this.getXMPPConnection()).getAccountAttribute(“name”)代码的位置,竟然没有报异常了,再修改到原来的位置,又报无响应了。原来代码中我自己定义了一个向服务端某个插件发包的语句,发包后收到结果会加入群组的操作A,但是很奇怪,这些操作都是异步的,为何会影响到获取name呢,看了下获取name的实现,也是向服务端发包,但是还是不明白原因,不过把获取name的代码挪到A前面,确实没有报错了。这个问题算是解决了,后续再深究原因吧

最终分析原因:自己写的自定义XMPP协议解析有问题。已更正
文章更新于2018年4月22日 22:14

登录时报错,原因 账号密码输入错误:

05-23 09:31:34.734 20320-20430/com.jiaxun.aruil D/XMPP_SMACK: SENT: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>ADEwMDEAZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=</auth>
05-23 09:31:34.735 20320-20343/com.jiaxun.aruil D/SessionLooperHandler: handleMessage finished
05-23 09:31:34.744 20320-20431/com.jiaxun.aruil D/XMPP_SMACK: RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
05-23 09:31:34.747 20320-20420/com.jiaxun.aruil W/XmppService: org.jivesoftware.smack.sasl.SASLErrorException: SASLError using PLAIN: not-authorized
                                                                   at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthentication.java:365)
                                                                   at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1044)
                                                                   at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:948)
                                                                   at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:963)
                                                                   at java.lang.Thread.run(Thread.java:818)
05-23 09:31:35.407 397-483/system_process D/TaskPersister: removeObsoleteFile: deleting file=6795_task.xml
05-23 09:31:35.408 397-483/system_process D/TaskPersister: removeObsoleteFile: deleting file=6795_task_thumbnail.png

注册时报错,原因:ejabberd服务端没配置(默认只允许带内注册)。XMPPError: forbidden - auth

05-23 20:36:09.460 10826-10884/com.wqx.dowa W/System.err: org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPP error reply received from 123.56.30.171: XMPPError: forbidden - auth
05-23 20:36:09.460 10826-10884/com.wqx.dowa W/System.err:     at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:263)
05-23 20:36:09.460 10826-10884/com.wqx.dowa W/System.err:     at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:214)
05-23 20:36:09.460 10826-10884/com.wqx.dowa W/System.err:     at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager.java:288)
05-23 20:36:09.460 10826-10884/com.wqx.dowa W/System.err:     at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager.java:254)
05-23 20:36:09.460 10826-10884/com.wqx.dowa W/System.err:     at com.wqx.dowa.smack.SmackImpl.register(SmackImpl.java:1229)
05-23 20:36:09.460 10826-10884/com.wqx.dowa W/System.err:     at com.wqx.dowa.activity.RegisterActivity$20.run(RegisterActivity.java:689)
05-23 20:36:09.461 10826-10884/com.wqx.dowa W/System.err:     at java.lang.Thread.run(Thread.java:761)

05-23 20:36:09.461 10826-10894/com.wqx.dowa D/SMACK: RCV PKT (1): <iq from='123.56.30.171' id='0pqDR-13' type='error'><error type='auth'><forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>Access denied by service policy</text></error></iq>
05-23 20:36:39.389 10826-10890/com.wqx.dowa D/SMACK: RECV (0): <stream:error><connection-timeout xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>Idle connection</text></stream:error></stream:stream>
05-23 20:36:39.393 10826-10893/com.wqx.dowa D/SMACK: RECV (1): <stream:error><connection-timeout xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>Idle connection</text></stream:error></stream:stream>
05-23 20:36:39.401 10826-10893/com.wqx.dowa W/AbstractXMPPConnection: Connection XMPPTCPConnection[not-authenticated] (1) closed with error
                                                                      org.jivesoftware.smack.XMPPException$StreamErrorException: connection-timeout You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions
                                                                      <stream:error><connection-timeout xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en'>Idle connection</text></stream:error>
                                                                          at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1064)
                                                                          at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:1000)
                                                                          at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1016)
                                                                          at java.lang.Thread.run(Thread.java:761)

ejabberd配置mysql数据库后,异常SASLError using SCRAM-SHA-1: not-authorized

05-24 12:30:35.740 24600-24698/com.wqx.dowa I/XmppService: LogUtils:XXException e=com.wqx.dowa.exception.XXException: SASLError using SCRAM-SHA-1: not-authorized
05-24 12:30:35.741 24600-24698/com.wqx.dowa I/com.wqx.dowa.service.XmppService: LogUtils:XMPPException in doConnect():
05-24 12:30:35.741 24600-24698/com.wqx.dowa W/System.err: com.wqx.dowa.exception.XXException: SASLError using SCRAM-SHA-1: not-authorized
05-24 12:30:35.742 24600-24698/com.wqx.dowa W/System.err:     at com.wqx.dowa.smack.SmackImpl.login(SmackImpl.java:536)
05-24 12:30:35.742 24600-24698/com.wqx.dowa W/System.err:     at com.wqx.dowa.service.XmppService$1.run(XmppService.java:230)
05-24 12:30:35.748 24600-24600/com.wqx.dowa I/LoginActivity: LogUtils:LoginActivity connectionStatusChanged connectedState=-1
05-24 12:30:35.748 24600-24600/com.wqx.dowa I/LoginActivity: LogUtils:LoginActivity connectionStatusChanged reason=SASLError using SCRAM-SHA-1: not-authorized
05-24 12:30:35.875 23178-24436/? I/SendBroadcastPermission: action:com.taobao.accs.intent.action.CONNECTINFO, mPermissionType:0

XMPPError: bad-request - modify error create new user using smack library 4.1.4 and openfire
使用openfir+smack4.1.4注册的时候 报错bad-request- modify

解决方法:

设置适当的服务名称 不要使用原始的(127.0.0.1)

登录openfire管理界面后会显示服务器名称 把那个名称设置上去就行了 下面是我的代码

 XMPPTCPConnectionConfiguration xmpp = XMPPTCPConnectionConfiguration.builder()
                    //服务器IP地址
                    .setHost("192.168.1.155")
                    //服务器端口
                    .setPort(5222)
                    //服务器名称(管理界面的 主机名)
//                    .setServiceName("127.0.0.1") 不设置默认的地址
                    .setServiceName("user-20150810nb")
                    //是否开启安全模式
                    .setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.disabled)
                    //是否开启压缩
                    .setCompressionEnabled(false)
                    .setSendPresence(false)
                    //开启调试模式
                    .setDebuggerEnabled(true)
                    .setUsernameAndPassword("admin", "admin")
                    .build();

https://blog.csdn.net/u011481547/article/details/72842738

12:02.657 5810-5922/com.jiaxun.aruil W/AbstractXMPPConnection: Connection closed with error
                                                                        java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
                                                                            at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:592)
                                                                            at libcore.io.IoBridge.recvfrom(IoBridge.java:556)
                                                                            at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485)
                                                                            at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37)
                                                                            at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)
                                                                            at java.io.InputStreamReader.read(InputStreamReader.java:231)
                                                                            at java.io.BufferedReader.read(BufferedReader.java:325)
                                                                            at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:41)
                                                                            at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515)
                                                                            at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992)
                                                                            at org.kxml2.io.KXmlParser.next(KXmlParser.java:349)
                                                                            at org.kxml2.io.KXmlParser.next(KXmlParser.java:313)
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1169)
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:948)
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:963)
                                                                            at java.lang.Thread.run(Thread.java:818)
                                                                         Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
                                                                            at libcore.io.Posix.recvfromBytes(Native Method)
                                                                            at libcore.io.Posix.recvfrom(Posix.java:185)
                                                                            at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:250)
                                                                            at libcore.io.IoBridge.recvfrom(IoBridge.java:553)
                                                                            at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485) 
                                                                            at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37) 
                                                                            at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) 
                                                                            at java.io.InputStreamReader.read(InputStreamReader.java:231) 
                                                                            at java.io.BufferedReader.read(BufferedReader.java:325) 
                                                                            at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:41) 
                                                                            at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515) 
                                                                            at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992) 
                                                                            at org.kxml2.io.KXmlParser.next(KXmlParser.java:349) 
                                                                            at org.kxml2.io.KXmlParser.next(KXmlParser.java:313) 
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1169) 
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:948) 
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:963) 
                                                                            at java.lang.Thread.run(Thread.java:818) 
07-17 19:12:02.658 5810-5922 D/XmppService: connectionClosedOnError   e=java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)

当调用connection时,报No longer connection异常,而又可以收到消息
排查,重新连接后,没有将新的connection设置给一个全局变量mConnection中,调用方法A时使用的还是之前的connection,故可以收到消息,但是发送消息(使用的旧connection)时失败

注册时报异常

 org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: internal-server-error - wait
org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: internal-server-error - wait

登录时的异常

08-22 06:35:52.047 13306-14308/com.wqx.dowa E/com.wqx.dowa.smack.SmackImpl: LogUtils:login(): org.jivesoftware.smack.sasl.SASLErrorException: SASLError using SCRAM-SHA-1: not-authorized
                                                                                at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthentication.java:291)
                                                                                at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1096)
                                                                                at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:994)
                                                                                at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1010)
                                                                                at java.lang.Thread.run(Thread.java:761)

原因分析:openfire运行的时候,删除了数据库中的某几条数据, of没有重启,导致注册异常,登录时也报异常,of重启后,重新注册,登录,正常

在eclipse中新建java工程,使用Smack3.2.1登录时,报异常

获得连接的err:Not connected to server.

之前代码:

connection.addConnectionListener(new ConnectionListener() {
				
				@Override
				public void reconnectionSuccessful() {
					// TODO Auto-generated method stub
					System.out.println("reconnectionSuccessful");
				}
				
				@Override
				public void reconnectionFailed(Exception e) {
					// TODO Auto-generated method stub
					System.out.println("reconnectionFailed e="+e.getMessage());
				}
				
				@Override
				public void reconnectingIn(int seconds) {
					// TODO Auto-generated method stub
					System.out.println("reconnectingIn seconds:"+seconds);
				}
				
				@Override
				public void connectionClosedOnError(Exception e) {
					// TODO Auto-generated method stub
					System.out.println("connectionClosedOnError: e="+e.getMessage());
				}
				
				@Override
				public void connectionClosed() {
					// TODO Auto-generated method stub
					System.out.println("connectionClosed");
				}
			});
connection.connect();

修改后代码

connection.connect();//放到添加监听前面
connection.addConnectionListener(new ConnectionListener() {
				
				@Override
				public void reconnectionSuccessful() {
					// TODO Auto-generated method stub
					System.out.println("reconnectionSuccessful");
				}
				
				@Override
				public void reconnectionFailed(Exception e) {
					// TODO Auto-generated method stub
					System.out.println("reconnectionFailed e="+e.getMessage());
				}
				
				@Override
				public void reconnectingIn(int seconds) {
					// TODO Auto-generated method stub
					System.out.println("reconnectingIn seconds:"+seconds);
				}
				
				@Override
				public void connectionClosedOnError(Exception e) {
					// TODO Auto-generated method stub
					System.out.println("connectionClosedOnError: e="+e.getMessage());
				}
				
				@Override
				public void connectionClosed() {
					// TODO Auto-generated method stub
					System.out.println("connectionClosed");
				}
			});

Linux Openfire进程自己关闭
系统:ubuntu 14.04 Openfire 4.3
Openfire运行一段时间后,登录不上,ps查看进程,没有openfire进程,自己莫名其妙的关闭了,原因未知,有遇到此情况并解决的请帮看下,留言

总是出现以下异常,原因未知

2018.09.26 01:03:00 ERROR [pool-1-thread-7]: org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager - Error processing file transfer proxy connection
java.io.IOException: Only SOCKS5 supported
2018.09.25 18:08:30 WARN  [socket_c2s-thread-2]: org.jivesoftware.openfire.nio.ConnectionHandler - Closing connection due to exception in session: (0x0000001F: nio socket, server, null => 0.0.0.0/0.0.0.0:5222)
java.io.IOException: Connection reset by peer

完整log

2018.09.25 08:04:14 WARN  [Jetty-QTP-BOSH-54]: org.eclipse.jetty.http.HttpParser - Illegal character 0x3 in state=START for buffer HeapByteBuffer@742db139[p=1,l=47,c=8192,r=46]={\x03<<<\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie:...nistr\r\n\x01\x00\x08\x00\x03\x00\x00\x00>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2018.09.25 08:04:14 WARN  [Jetty-QTP-BOSH-54]: org.eclipse.jetty.http.HttpParser - badMessage: 400 Illegal character 0x3 for HttpChannelOverHttp@23b747de{r=0,c=false,a=IDLE,uri=}
2018.09.25 09:03:44 WARN  [socket_c2s-thread-3]: org.jivesoftware.openfire.nio.ConnectionHandler - Closing connection due to exception in session: (0x00000014: nio socket, server, null => 0.0.0.0/0.0.0.0:5222)
java.io.IOException: Connection reset by peer
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:197)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
	at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:273)
	at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:44)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:690)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:664)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:653)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1124)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.25 09:08:16 WARN  [socket_c2s-thread-3]: org.jivesoftware.openfire.nio.ConnectionHandler - Closing connection due to exception in session: (0x00000015: nio socket, server, null => 0.0.0.0/0.0.0.0:5222)
java.io.IOException: Connection reset by peer
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:197)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
	at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:273)
	at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:44)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:690)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:664)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:653)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1124)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.25 09:29:08 WARN  [socket_c2s-thread-2]: class org.jivesoftware.openfire.streammanagement.StreamManager[223.104.3.147] - Closing client session. Client acknowledges stanzas that we didn't send! Client Ack h: 111, our last stanza: 110, affected session: org.jivesoftware.openfire.session.LocalClientSession@3ed087bf status: 3 address: 10073@dowa.com/dowa id: 8cwpfmreoi presence: 
<presence id="siTI6-40" from="10073@dowa.com/dowa">
  <status>在线</status>
  <priority>0</priority>
  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack" ver="lWpWNgqtfynY+MxupmhOr2LZqOg="></c>
</presence>
2018.09.25 09:36:20 WARN  [socket_c2s-thread-3]: org.jivesoftware.openfire.nio.ConnectionHandler - Closing connection due to exception in session: (0x00000018: nio socket, server, null => 0.0.0.0/0.0.0.0:5222)
java.io.IOException: Connection reset by peer
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:197)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
	at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:273)
	at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:44)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:690)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:664)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:653)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1124)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.25 10:52:05 WARN  [Jetty-QTP-AdminConsole-37]: org.eclipse.jetty.http.HttpParser - badMessage: 400 No URI for HttpChannelOverHttp@7c2faf0e{r=0,c=false,a=IDLE,uri=}
2018.09.25 14:50:22 ERROR [pool-1-thread-2]: org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager - Error processing file transfer proxy connection
java.io.IOException: Only SOCKS5 supported
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.processConnection(ProxyConnectionManager.java:156)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.access$200(ProxyConnectionManager.java:53)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager$1$1.run(ProxyConnectionManager.java:125)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.25 15:03:34 ERROR [pool-1-thread-3]: org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager - Error processing file transfer proxy connection
java.io.IOException: Only SOCKS5 supported
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.processConnection(ProxyConnectionManager.java:156)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.access$200(ProxyConnectionManager.java:53)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager$1$1.run(ProxyConnectionManager.java:125)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.25 17:37:35 ERROR [pool-1-thread-5]: org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager - Error processing file transfer proxy connection
java.io.IOException: Only SOCKS5 supported
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.processConnection(ProxyConnectionManager.java:156)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.access$200(ProxyConnectionManager.java:53)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager$1$1.run(ProxyConnectionManager.java:125)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.25 17:37:36 ERROR [pool-1-thread-5]: org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager - Error processing file transfer proxy connection
java.io.IOException: Only SOCKS5 supported
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.processConnection(ProxyConnectionManager.java:156)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.access$200(ProxyConnectionManager.java:53)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager$1$1.run(ProxyConnectionManager.java:125)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.25 18:08:30 WARN  [socket_c2s-thread-2]: org.jivesoftware.openfire.nio.ConnectionHandler - Closing connection due to exception in session: (0x0000001F: nio socket, server, null => 0.0.0.0/0.0.0.0:5222)
java.io.IOException: Connection reset by peer
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:197)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
	at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:273)
	at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:44)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:690)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:664)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:653)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1124)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.25 19:52:59 ERROR [pool-1-thread-6]: org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager - Error processing file transfer proxy connection
java.io.IOException: Only SOCKS5 supported
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.processConnection(ProxyConnectionManager.java:156)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.access$200(ProxyConnectionManager.java:53)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager$1$1.run(ProxyConnectionManager.java:125)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.26 01:03:00 ERROR [pool-1-thread-7]: org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager - Error processing file transfer proxy connection
java.io.IOException: Only SOCKS5 supported
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.processConnection(ProxyConnectionManager.java:156)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager.access$200(ProxyConnectionManager.java:53)
	at org.jivesoftware.openfire.filetransfer.proxy.ProxyConnectionManager$1$1.run(ProxyConnectionManager.java:125)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2018.09.26 04:41:08 WARN  [socket_c2s-thread-2]: class org.jivesoftware.openfire.streammanagement.StreamManager[103.238.135.242] - Closing client session. Client acknowledges stanzas that we didn't send! Client Ack h: 54, our last stanza: 40, affected session: org.jivesoftware.openfire.session.LocalClientSession@7ed085a4 status: 3 address: 10073@test.com/test id: 2jcswah3f0 presence: 
<presence id="8HMs4-41" from="10073@test.com/test">
  <status>在线</status>
  <priority>0</priority>
  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack" ver="lWpWNgqtfynY+MxupmhOr2LZqOg="></c>
</presence>
2018.09.26 04:48:09 WARN  [Update Manager]: org.apache.commons.httpclient.HttpMethodBase - Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
2018.09.26 04:48:10 WARN  [Update Manager]: org.apache.commons.httpclient.HttpMethodBase - Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
2018.09.26 05:50:46 WARN  [Jetty-QTP-AdminConsole-36]: org.eclipse.jetty.http.HttpParser - Illegal character 0x3 in state=START for buffer HeapByteBuffer@23d10682[p=1,l=47,c=8192,r=46]={\x03<<<\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie:...nistr\r\n\x01\x00\x08\x00\x03\x00\x00\x00>>>0 GMT\r\nSet-Cookie...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2018.09.26 05:50:46 WARN  [Jetty-QTP-AdminConsole-36]: org.eclipse.jetty.http.HttpParser - badMessage: 400 Illegal character 0x3 for HttpChannelOverHttp@19a96a9c{r=0,c=false,a=IDLE,uri=}

Smack 好友关系梳理

Roster对象,可以理解为保存好友的花名册,接收好友请求的三种模式:Roster.SubscriptionMode.accept_all接受所有、Roster.SubscriptionMode.reject_all拒绝所有、Roster.SubscriptionMode.manual手动处理所有;

Openfire的ofroster表的字段包括sub订阅、ask是否有发送订阅请求、rec是否有接受订阅请求;

sub订阅:

-1  remove  发送删除用户请求

0    none     用户没有建立好友关系

1    to          发送订阅请求且请求被接受

2    from      接受好友订阅请求

3    both      双方互为好友关系

ask是否有发送订阅请求:

-1    null      没有发送好友请求

0    subscribe  发送好友订阅请求但没回复

1    unsubscribe  发送取消订阅好友请求

rec是否有接受订阅请求:

-1    null      没有收到好友订阅请求

1     sub      收到好友订阅请求但没回复

2    unsub   收到好友取消订阅请求

A 发送好友申请给 B      
sub  ask  recv          
0    0    -1      
加入数据库

B登录后,收到好友申请请求     收到的,设置为 未读,未处理
sub  ask  recv
0    -1   1
加入数据库


B登录后,收到好友申请请求,查看     收到的,设置为 已读,未处理
sub  ask  recv
0    -1   1
更新数据库


B同意好友申请请求           设置为已读,已处理
sub  ask  recv
2    -1   -1
更新数据库


A 收到对方同意请求
sub  ask  recv
1    -1   -1
更新数据库


B同意好友申请请求后,向A发起好友申请请求        已读,已处理
sub  ask  recv
2    0     -1        
更新数据库


A 收到对方的申请请求
sub  ask  recv
1    -1   1
更新数据库


A 收到对方的申请请求,同意
sub  ask  recv
3    -1   -1
更新数据库


B收到A的同意
sub  ask  recv
3   -1    -1        
更新数据库

https://blog.csdn.net/chuyouyinghe/article/details/54345681
https://blog.csdn.net/flyforqie/article/details/39208769
https://www.jianshu.com/p/9c0c3ed181aa
https://blog.csdn.net/u013100574/article/details/52923547?utm_source=blogxgwz0

Smack4.1.6 Tigase 7.0.1 长时间发群消息后,接收不到消息。服务端关闭连接了,但是客户端没有收到关闭连接的回调,导致客户端假在线,原因未知

2018-11-1 09:14:08 815: 495: DEBUG: XMPP_SMACK:RECV: 
<iq from="10.10.xx.xx" to="10009@10.10.xx.xx/test" type="get" id="tigase-ping">
<ping xmlns="urn:xmpp:ping"/>
</iq>
2018-11-1 09:14:08 821: 494: DEBUG: XMPP_SMACK:SENT: 
<iq to='10.10.xx.xx' id='tigase-ping' type='result'></iq>
2018-11-1 09:14:08 905: 495: DEBUG: XMPP_SMACK:RECV: 
<iq from="10.10.xx.xx" xmlns="jabber:client" type="error" id="tigase-ping">
<error code="501" type="cancel">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">Feature not supported yet.</text>
</error>
</iq>

消息丢失问题:
没有登录成功(只是连接成功),但是却收到消息了

XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setHost(address);////XmppConfig.XMPP_HOST
configBuilder.setServiceName(serviceName);
configBuilder.setResource("jiaxun");
            configBuilder.setUsernameAndPassword(account, password);
            configBuilder.setDebuggerEnabled(true);
            configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
            mConnection = new XMPPTCPConnection(configBuilder.build());
            ReconnectionManager.getInstanceFor(mConnection).disableAutomaticReconnection();
            //之前自动回执放到了这里,故有消息丢失的情况
            //Set ConnectionListener here to catch initial connect();
            mConnection.addConnectionListener(this);
            if (!mConnection.isConnected())
            {
                mConnection.connect();
            }
            if (mConnection.isConnected() && !mConnection.isAuthenticated())
            {
                mConnection.login();
            }
if (mConnection.isAuthenticated())
 {
mDeliveryReceiptManager = DeliveryReceiptManager.getInstanceFor(mConnection);
                if (needreceipt)
                {
                    // 自动发送消息回执
                    mDeliveryReceiptManager.setAutoReceiptMode(DeliveryReceiptManager.AutoReceiptMode.always);
                    // 添加消息回执监听
                    mDeliveryReceiptManager.addReceiptReceivedListener(XmppMessage.getInstance());
                }
}

自动发送消息回执的代码需要放到登录成功之后,不要放到配置xmppConnection的地方。

https://blog.csdn.net/5207/article/details/72822399 XMPP协议之消息回执解决方案

2018-12-14 12:06:48.606 2615-3301/com.wqx.dowa E/SmackImpl: LogUtils:login(): org.jivesoftware.smack.sasl.SASLErrorException: SASLError using SCRAM-SHA-1: not-authorized
Smack 修改密码:
一、使用发包的形式
1、此方式可以不用登录,修改密码,但是修改后,新密码登录时会报上面的错误,发包修改的密码,服务端应该是做了处理。估计是需要先对密码加密(猜测),后才能登录

XMPPTCPConnection con = getXMPPTCPConnection();
		//con.login(username, password);
		AccountManager.sensitiveOperationOverInsecureConnectionDefault(true);
		//AccountManager.getInstance(con).changePassword(newPassword);
			Map<String, String> map = new HashMap<>();
			
	        map.put("username",  username);
	        map.put("password",newPassword);
	        Registration reg = new Registration(map);
	        reg.setType(IQ.Type.set);
	        reg.setTo(con.getXMPPServiceDomain());
	        con.sendStanza(reg);
		System.out.println("更新密码到: " + xmppConfig.getHost() + ", " + username + "  , " + newPassword);
		//con.disconnect();

二、使用AccountManager修改密码

XMPPTCPConnection con = getXMPPTCPConnection();
		con.login(username, password);
		AccountManager.sensitiveOperationOverInsecureConnectionDefault(true);
		AccountManager.getInstance(con).changePassword(newPassword);
//			Map<String, String> map = new HashMap<>();
//			
//	        map.put("username",  username);
//	        map.put("password",newPassword);
//	        Registration reg = new Registration(map);
//	        reg.setType(IQ.Type.set);
//	        reg.setTo(con.getXMPPServiceDomain());
//	        con.sendStanza(reg);
		System.out.println("更新密码到: " + xmppConfig.getHost() + ", " + username + "  , " + newPassword);
		con.disconnect();

需要登录,修改密码后使用新密码(明文)可以正常登录

https://blog.csdn.net/ghjzzhg/article/details/80238258 Openfire忘记密码的解密过程

1、首先在数据库的ofuser的表中找到username的值为admin的数据(openfire管理员默认为admin),然后找到对应的加密密码encryptedPassword
2、再到ofproperty的表中找到name为passwordKey的数据,获得值proValue
3、解密过程需要用到openfire的jar包------openfire的jar包链接
4、当然也可以直接使用openfire.jar包中的核心作为工具类,已实践ok------Blowfish工具类链接
--------------------- 
作者:ghjzzhg 
来源:CSDN 
原文:https://blog.csdn.net/ghjzzhg/article/details/80238258 
版权声明:本文为博主原创文章,转载请附上博文链接!
public static void main(String args[]) throws Exception {
        //passWordKey:加密的密码
        String passWordKey = "f0de8d3f05b691b5f1f52cca2804b7f2cacefbc968c17239d1752261";
        String passwordKey = "IX7vOyGjmKb1";//ofproperty中的秘钥
        Blowfish blowFish = new Blowfish(passwordKey);
        String mingwen = blowFish.decryptString(passWordKey); //解密后明文密码
        System.out.println(mingwen);
    }

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试