Openfire连接因内部错误而关闭

时间:2016-06-13 13:58:39

标签: java ubuntu xmpp openfire smack

所以我有这个代码连接到openfire

XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration.builder();  

      config.setUsernameAndPassword(loginUser, passwordUser);
      config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
      config.setServiceName(serverAddress);
      config.setHost(serverAddress);
      config.setPort(5222);
      config.setDebuggerEnabled(true);
      connection = new XMPPTCPConnection(config.build());
  ReconnectionManager.getInstanceFor(connection).enableAutomaticReconnection();

      System.out.println("Reconnection enabled : " + ReconnectionManager.getInstanceFor(connection).isAutomaticReconnectEnabled());

      ConnectionListener connectionListener = new XMPPConnectionListener();
      connection.addConnectionListener(connectionListener);

但是当我尝试连接时,我收到此错误:

  

org.jivesoftware.smack.XMPPException $ StreamErrorException:internal-server-error您可以在http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions阅读有关此流错误含义的更多信息          在org.jivesoftware.smack.tcp.XMPPTCPConnection $ PacketReader.parsePackets(XMPPTCPConnection.java:1007)       在org.jivesoftware.smack.tcp.XMPPTCPConnection $ PacketReader.access $ 300(XMPPTCPConnection.java:948)       在org.jivesoftware.smack.tcp.XMPPTCPConnection $ PacketReader $ 1.run(XMPPTCPConnection.java:963)       在java.lang.Thread.run(Thread.java:744)

编辑: Openfire的日志:

警告日志:

2016.06.13 11:06:31 org.apache.mina.core.filterchain.DefaultIoFilterChain - Unexpected exception from exceptionCaught handler. 
java.lang.NoSuchMethodError:     java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView; 
at org.jivesoftware.openfire.roster.Roster.broadcastPresence(Roster.java:628) 
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.broadcastUpdate(PresenceUpdateHandler.java:309) 
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:163) 
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:138) 
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:202) 
at org.jivesoftware.openfire.PresenceRouter.handle(PresenceRouter.java:144) 
at org.jivesoftware.openfire.PresenceRouter.route(PresenceRouter.java:80) 
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:88) 
at org.jivesoftware.openfire.SessionManager$ClientSessionListener.onConnectionClose(SessionManager.java:1267) 
at org.jivesoftware.openfire.nio.NIOConnection.notifyCloseListeners(NIOConnection.java:266) 
at org.jivesoftware.openfire.nio.NIOConnection.close(NIOConnection.java:248) 
at org.jivesoftware.openfire.nio.ConnectionHandler.exceptionCaught(ConnectionHandler.java:162) 

我试图连接到本地的openfire服务器(Windows),我成功了,但是当我尝试连接到ubuntu openfre服务器时,我失败了。 任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:1)

较新版本的Openfire需要Java 8(或更高版本)。

答案 1 :(得分:0)

确切地说:openfire需要oracle jre 8 NOT Openjdk