0

So i have this code to connect to 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);

but when i try to connect i get this error :

org.jivesoftware.smack.XMPPException$StreamErrorException: internal-server-error You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1007) 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:744)

EDIT : Openfire's log :

Warn log :

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) 

i tried to connect to a local openfire server(windows), i succeded, but I fail when i try to connect to an ubuntu openfre server. Any help would be appreciated.

OddDev
  • 1,521
  • 7
  • 23
  • 45

2 Answers2

1

Newer versions of Openfire need Java 8 (or higher).

Flow
  • 23,572
  • 15
  • 99
  • 156
  • I can't contradict you but what about to not use OpenJDK? I'm really interested... – MrPk Jun 13 '16 at 15:18
  • I've made no statements about using OpenJRE or any other Java 8 compliant runtime environment. – Flow Jun 13 '16 at 15:19
  • I know, but I know that you are an Openfire "admin" and I was referring about comments on official website (Guus der Kinderen 24 March) @Flow – MrPk Jun 13 '16 at 15:36
  • Valid Point: I'd simply express this request in the ingiterealtime.org community forums. – Flow Jun 13 '16 at 15:41
  • well, i have the openjdk-8 and still the same error, i'm trying with oracle jdk – OddDev Jun 13 '16 at 16:49
  • "Having" OpenJDK not automatically implies that Openfire is run with it. Did you verify that Openfire was started with openjdk-8? – Flow Jun 14 '16 at 09:11
  • Yep I've tried, and the server was installed, when I try connecting to server I get internal error. – OddDev Jun 14 '16 at 10:59
  • And yep that was the only jre on server – OddDev Jun 14 '16 at 10:59
0

To be precise : openfire needs oracle jre 8 NOT Openjdk

OddDev
  • 1,521
  • 7
  • 23
  • 45
  • what about oracle jre 7? – MrPk Jun 14 '16 at 08:40
  • I don't think that it matters if it's an Oracle JRE or OpenJRE. See also http://stackoverflow.com/questions/22358071/differences-between-oracle-jdk-and-open-jdk-and-garbage-collection – Flow Jun 14 '16 at 09:09
  • Believe me, it does, at least that's what I experienced lately, with openjdk clients can't connect to server but when I changed to oracle's jre all went fine. – OddDev Jun 14 '16 at 10:56
  • I faced same issue to run Openfire in Eclipse, basically there is a method signature changed on ConcurrentHashMap. To run it with Java7 I declared the maps as Interface (Map) and added some cast. But i now need to avoid the problem on real server, if possibile without install JRE8 ;) – MrPk Jun 14 '16 at 12:32