Exception in thread "main" No response from server.:
at org.jivesoftware.smackx.muc.MultiUserChat.create(MultiUserChat.java:367)
at com.smack.Test3CreateChatGroup.creatMultiRoom(Test3CreateChatGroup.java:44)
这个问题被搞了一天,下班之前终于搞定了,查了很多资料。
具体参考如下(我都没有解决)
1:http://blog.youkuaiyun.com/za143567229za/article/details/40654851
2:http://macleo.iteye.com/blog/1815024
3:应该是网络环境不好
最后看来一个评论,给了我思路:http://blog.youkuaiyun.com/lnb333666/article/details/7598683 14楼 传入房间的的jid,不是用户的,我之前遇到过。
MultiUserChat muc = new MultiUserChat(connection, "wq@192.168.1.1"); 这是我之前的写法(也试过很多种格式,均不行),看完评论觉得是地址写错了 .
接着仔细看了spark的群组,发现是 wq@muc.192.168.1.1。然后加上了muc,之前看了很多案例,都没有加muc,都是直接写的地址,不知道为啥我的要加这个。
不要以为加上这个就可以创建成功了,只是不会报错
还要加很多参数
感觉 muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT)); 这句最有用。
还有在其他帖子看到的一句话:
- /*---创建默认配置的聊天室 ---
- 先看看官方的文档:
- Creates a new multi user chat with the specified connection and room name. Note: no
- * information is sent to or received from the server until you attempt to
- * {@link #join(String) join} the chat room. On some server implementations,
- * the room will not be created until the first person joins it
- * 最重要一句:直到用户调用join方法的时候聊天室才会被创建
- */