一、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.test.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.test.dowa W/System.err: at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:263)
05-23 20:36:09.460 10826-10884/com.test.dowa W/System.err: at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:214)
05-23 20:36:09.460 10826-10884/com.test.dowa W/System.err: at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager.java:288)
05-23 20:36:09.460 10826-10884/com.test.dowa W/System.err: at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager.java:254)
05-23 20:36:09.460 10826-10884/com.test.dowa W/System.err: at com.test.dowa.smack.SmackImpl.register(SmackImpl.java:1229)
05-23 20:36:09.460 10826-10884/com.test.dowa W/System.err: at com.test.dowa.activity.RegisterActivity$20.run(RegisterActivity.java:689)
05-23 20:36:09.461 10826-10884/com.test.dowa W/System.err: at java.lang.Thread.run(Thread.java:761)
05-23 20:36:09.461 10826-10894/com.test.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.test.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.test.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.test.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.test.im I/XmppService: LogUtils:XXException e=com.test.im.exception.XXException: SASLError using SCRAM-SHA-1: not-authorized
05-24 12:30:35.741 24600-24698/com.test.im I/com.test.im.service.XmppService: LogUtils:XMPPException in doConnect():
05-24 12:30:35.741 24600-24698/com.test.im W/System.err: com.test.im.exception.XXException: SASLError using SCRAM-SHA-1: not-authorized
05-24 12:30:35.742 24600-24698/com.test.im W/System.err: at com.test.im.smack.SmackImpl.login(SmackImpl.java:536)
05-24 12:30:35.742 24600-24698/com.test.im W/System.err: at com.test.im.service.XmppService$1.run(XmppService.java:230)
05-24 12:30:35.748 24600-24600/com.test.im I/LoginActivity: LogUtils:LoginActivity connectionStatusChanged connectedState=-1
05-24 12:30:35.748 24600-24600/com.test.im 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
XMPPErrorException: XMPP error reply received from dowa.com: XMPPError: bad-request - modify
使用openfir4x+smack4x注册的时候 报错bad-request- modify
解决方法:
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.test.im E/com.test.im.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/im id: 8cwpfmreoi presence:
<presence id="siTI6-40" from="10073@dowa.com/im">
<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.test.im 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);
}
AccountManager 注册时 (创建用户)报错
java.lang.IllegalStateException: Creating account over insecure connection
AccountManager accountManager = AccountManager.getInstance(XmppConnection.getInstance().getConnection());
Log.i(TAG, "onClick: "+accountManager.supportsAccountCreation());
if(accountManager.supportsAccountCreation()){
accountManager.sensitiveOperationOverInsecureConnection(true);
Log.e(TAG, "onClick: account:"+account);
Log.e(TAG, "onClick: pwd:"+pwd);
accountManager.createAccount(Localpart.from(account), pwd);
}
}
由于粗心,之前一直写的是
AccountManager.sensitiveOperationOverInsecureConnectionDefault(true);
应该是
accountManager.sensitiveOperationOverInsecureConnection(true);
https://www.jianshu.com/p/0a726d347367 基于 Smack 的 xmpp 学习笔记
https://blog.csdn.net/frankcheng5143/article/details/48622649 一步一步调通Openfire3.10.2+smack4.1.4官方示例代码
No response received within reply timeout. Timeout was 30000ms (~30s). While waiting for stream compression feature
(YOUR PREFIX):onHandleIntent: e:No response received within reply timeout. Timeout was 30000ms (~30s). While waiting for stream compression feature
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 30000ms (~30s). While waiting for stream compression feature
at org.jivesoftware.smack.SynchronizationPoint.checkForResponse(SynchronizationPoint.java:317)
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(SynchronizationPoint.java:160)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginInternal(XMPPTCPConnection.java:408)
at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:546)
at com.demo.xmpp.XmppService.onHandleIntent(XmppService.java:172)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:68)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.os.HandlerThread.run(HandlerThread.java:65)
SASL认证时候,一直处于等待 服务器无响应
No response received within reply timeout. Timeout was 30000ms (~30s). While waiting for successful SASL authentication
I/XmppService: (YOUR PREFIX):onHandleIntent: e:No response received within reply timeout. Timeout was 30000ms (~30s). While waiting for successful SASL authentication
W/System.err: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 30000ms (~30s). While waiting for successful SASL authentication
W/System.err: at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:224)
W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginInternal(XMPPTCPConnection.java:403)
W/System.err: at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:546)
W/System.err: at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:68)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:108)
W/System.err: at android.os.Looper.loop(Looper.java:166)
W/System.err: at android.os.HandlerThread.run(HandlerThread.java:65)
账号密码 错误
D/SMACK: SENT (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>ADEwMDAwOTc3ADIwMmNiOTYyYWM1OTA3NWI5NjRiMDcxNTJkMjM0Yjcw</auth>
D/SMACK: RECV (0): <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/><text xml:lang='en'>Password not verified</text></failure>
I/XmppService: (YOUR PREFIX):onHandleIntent: e:SASLError using PLAIN: not-authorized
W/System.err: org.jivesoftware.smack.sasl.SASLErrorException: SASLError using PLAIN: not-authorized
W/System.err: at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthentication.java:292)
W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1200)
W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$1000(XMPPTCPConnection.java:1092)
W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1112)
W/System.err: at java.lang.Thread.run(Thread.java:760)
D/SMACK: RECV (0): <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/><text xml:lang='en'>Password not verified</text></failure>
D/SMACK: SENT (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>ADEwMDAwOTc3ADIwMmNiOTYyYWM1OTA3NWI5NjRiMDcxNTJkMjM0Yjcw</auth>
个别帐号提示 host-unknown 原因未知
host-unknown You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions
org.jivesoftware.smack.XMPPException$StreamErrorException: host-unknown You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions
<stream:error><host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1159)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$1000(XMPPTCPConnection.java:1092)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1112)
at java.lang.Thread.run(Thread.java:761)
.jivesoftware.smack.SmackException$SmackWrappedException: org.jivesoftware.smack.SmackException: Parser got END_DOCUMENT event. This could happen e.g. if the server closed the connection without sending a closing stream element
at org.jivesoftware.smack.tcp.XMPPTCPConnection$2.run(XMPPTCPConnection.java:998)
at org.jivesoftware.smack.AsyncButOrdered$Handler.run(AsyncButOrdered.java:135)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:784)
Caused by: org.jivesoftware.smack.SmackException: Parser got END_DOCUMENT event. This could happen e.g. if the server closed the connection without sending a closing stream element
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1349)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$1000(XMPPTCPConnection.java:1092)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1112)
at java.lang.Thread.run(Thread.java:784)
Tigase 8.0 连接mongodb jar包打包 异常
[INFO] Running tigase.kernel.GenericBeanKernelTest
java.lang.UnsupportedClClass name: META-INF.versions.9.module-info
assVersionError: META-INF/versions/9/module-info has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at tigase.util.ClassUtil.getClassesFromNames(ClassUtil.java:176)
at tigase.util.ClassUtil.getClassesFromClassPath(ClassUtil.java:133)
at tigase.util.reflection.ClassUtilBean.initialize(ClassUtilBean.java:90)
at tigase.util.reflection.ClassUtilBean.getInstance(ClassUtilBean.java:65)
at tigase.kernel.beans.config.AbstractBeanConfigurator.registerBeansForBeanOfClass(AbstractBeanConfigurator.java:150)
at tigase.kernel.core.Kernel.initBean(Kernel.java:125)
at tigase.kernel.core.Kernel.getInstance(Kernel.java:992)
at tigase.kernel.core.Kernel.getInstance(Kernel.java:271)
at tigase.kernel.GenericBeanKernelTest.testGenerics(GenericBeanKernelTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:410)
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)
Class not found name: com.mongodb.connection.netty.NettyStream$1
Class not found name: com.mongodb.connection.netty.NettyStream$2
Class not found name: com.mongodb.connection.netty.NettyStream$InboundBufferHandler
Class not found name: com.mongodb.connection.netty.NettyStream$OpenChannelFutureListener
Class not found name: com.mongodb.connection.netty.NettyStream$OpenChannelFutureListener$1
Class not found name: com.mongodb.connection.netty.ReadTimeoutHandler
Class name: META-INF.versions.9.module-info
更新于 2020年2月1日 15:55
--------- beginning of crash
2020-11-22 21:43:04.251 22921-23076/com.test E/AndroidRuntime: FATAL EXCEPTION: Smack Reader (0)
Process: com.test, PID: 22921
java.lang.AssertionError
at org.jivesoftware.smackx.disco.provider.DiscoverInfoProvider.parse(DiscoverInfoProvider.java:79)
at org.jivesoftware.smackx.disco.provider.DiscoverInfoProvider.parse(DiscoverInfoProvider.java:32)
at org.jivesoftware.smack.provider.Provider.parse(Provider.java:43)
at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:616)
at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:157)
at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1084)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1300(XMPPTCPConnection.java:155)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1144)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$1000(XMPPTCPConnection.java:1092)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1112)
at java.lang.Thread.run(Thread.java:764)
build依赖中引用了实验性的东西
如下:注释掉experimental 相关的即可
implementation "org.igniterealtime.smack:smack-android-extensions:4.3.4"
//implementation "org.igniterealtime.smack:smack-experimental:4.3.4"
implementation "org.igniterealtime.smack:smack-tcp:4.3.4"
更新于2020年11月22日 22:01 ylxy3eefzt