Confusion with openfire connection errors

Dear Community!
I have set up my openfire server and i can connect to the server. The online message can also be sent successfully. I have created a test user called test which once connected to the server once. Now comes my confusion. When i want to send a message to the test user liek in the code below i get multiple exceptions in the logs. As far as i understand they state that the server tries to connect to another server which obviously does nto exist. Why can’t the server send the message to the other user or store it if he is not online when they were both connected to the same server?

The code:

public class Program
{
   public static async Task Main()
   {
       XmppClient xmppClient = new XmppClient(
           conf =>
           {
               conf.UseSocketTransport(new StaticNameResolver(new Uri("tcp://localhost:5222")));
               conf.WithCertificateValidator(new AlwaysAcceptCertificateValidator());
               //conf.UseWebSocketTransport();
               conf.AutoReconnect = true;

               // when your server dow not support SRV records or
               // XEP-0156 Discovering Alternative XMPP Connection Methods
               // then you need to supply host and port for the connection as well.
               // See docs => Host disconvery
           }
       )
       {
           Jid = "test@local.com",
           Password = "Passwort"
       };

// subscribe to the Binded session state
       xmppClient
           .StateChanged
           .Where(s => s == SessionState.Binded)
           .Subscribe(async v =>
           {
               // request roster (contact list).
               // This is optional, but most chat clients do this on startup
               var roster = await xmppClient.RequestRosterAsync();
       
               // send our online presence to the server
               await xmppClient.SendPresenceAsync(Show.Chat, "free for chat");

               // send a chat message to user2
               await xmppClient.SendChatMessageAsync("WoistdasNiveau@local.com", "This is a test");
           });

// connect so the server
       await xmppClient.ConnectAsync();

// wait for a key press
       Console.ReadLine();

// Close connection again
       await xmppClient.DisconnectAsync();
   }
}

The exceptions:


2024.05.25 17:28:10.194 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.SocketUtil - Creating a socket connection to XMPP domain 'local.com' ...
2024.05.25 17:28:10.194 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.SocketUtil - Use DNS to resolve remote hosts for the provided XMPP domain 'local.com' (default port: 5269) ...
2024.05.25 17:28:10.243 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.DNSUtil - No SRV record found for '_xmpp-server._tcp.local.com.'
javax.naming.NameNotFoundException: DNS name not found [response code 3]
	at com.sun.jndi.dns.DnsClient.checkResponseCode(DnsClient.java:659) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.isMatchResponse(DnsClient.java:577) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:429) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.query(DnsClient.java:214) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.Resolver.query(Resolver.java:81) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434) ~[jdk.naming.dns:?]
	at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235) ~[?:?]
	at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141) ~[?:?]
	at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129) ~[?:?]
	at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:171) ~[?:?]
	at org.jivesoftware.openfire.net.DNSUtil.srvLookup(DNSUtil.java:236) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.net.DNSUtil.resolveXMPPDomain(DNSUtil.java:120) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.net.SocketUtil.createSocketToXmppDomain(SocketUtil.java:62) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.nio.NettySessionInitializer.init(NettySessionInitializer.java:100) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.createOutgoingSession(LocalOutgoingServerSession.java:262) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.authenticateDomain(LocalOutgoingServerSession.java:209) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.establishConnection(OutgoingSessionPromise.java:288) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(OutgoingSessionPromise.java:244) [xmppserver-4.8.1.jar:4.8.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2024.05.25 17:28:10.289 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.DNSUtil - No SRV record found for '_xmpps-server._tcp.local.com.'
javax.naming.NameNotFoundException: DNS name not found [response code 3]
	at com.sun.jndi.dns.DnsClient.checkResponseCode(DnsClient.java:659) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.isMatchResponse(DnsClient.java:577) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:429) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.query(DnsClient.java:214) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.Resolver.query(Resolver.java:81) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434) ~[jdk.naming.dns:?]
	at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235) ~[?:?]
	at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141) ~[?:?]
	at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129) ~[?:?]
	at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:171) ~[?:?]
	at org.jivesoftware.openfire.net.DNSUtil.srvLookup(DNSUtil.java:236) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.net.DNSUtil.resolveXMPPDomain(DNSUtil.java:133) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.net.SocketUtil.createSocketToXmppDomain(SocketUtil.java:62) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.nio.NettySessionInitializer.init(NettySessionInitializer.java:100) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.createOutgoingSession(LocalOutgoingServerSession.java:262) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.authenticateDomain(LocalOutgoingServerSession.java:209) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.establishConnection(OutgoingSessionPromise.java:288) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(OutgoingSessionPromise.java:244) [xmppserver-4.8.1.jar:4.8.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2024.05.25 17:28:10.331 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.DNSUtil - No SRV record found for '_jabber._tcp.local.com.'
javax.naming.NameNotFoundException: DNS name not found [response code 3]
	at com.sun.jndi.dns.DnsClient.checkResponseCode(DnsClient.java:659) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.isMatchResponse(DnsClient.java:577) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:429) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsClient.query(DnsClient.java:214) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.Resolver.query(Resolver.java:81) ~[jdk.naming.dns:?]
	at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434) ~[jdk.naming.dns:?]
	at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235) ~[?:?]
	at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141) ~[?:?]
	at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129) ~[?:?]
	at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:171) ~[?:?]
	at org.jivesoftware.openfire.net.DNSUtil.srvLookup(DNSUtil.java:236) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.net.DNSUtil.resolveXMPPDomain(DNSUtil.java:141) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.net.SocketUtil.createSocketToXmppDomain(SocketUtil.java:62) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.nio.NettySessionInitializer.init(NettySessionInitializer.java:100) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.createOutgoingSession(LocalOutgoingServerSession.java:262) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.authenticateDomain(LocalOutgoingServerSession.java:209) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.establishConnection(OutgoingSessionPromise.java:288) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(OutgoingSessionPromise.java:244) [xmppserver-4.8.1.jar:4.8.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2024.05.25 17:28:10.332 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.SocketUtil - Found 1 host(s) for XMPP domain 'local.com'.
2024.05.25 17:28:10.333 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.SocketUtil - - local.com:5269 (no direct TLS)
2024.05.25 17:28:10.334 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.SocketUtil - Trying to create socket connection to XMPP domain 'local.com' using remote host: local.com:5269 (blocks up to 120000 ms) ...
2024.05.25 17:28:11.191 e[36mDEBUGe[m [socket_c2s-thread-2]: org.jivesoftware.openfire.net.StanzaHandler - Closing session as an end-of-stream was received: LocalClientSession{address=test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427, streamID=tqik3vec1, status=AUTHENTICATED, isEncrypted=true, isDetached=false, serverName='local', isInitialized=true, hasAuthToken=true, peer address='172.17.0.1', presence='
<presence from="test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427">
  <show>chat</show>
  <status>free for chat</status>
</presence>'}
2024.05.25 17:28:11.197 e[36mDEBUGe[m [socket_c2s-thread-2]: org.jivesoftware.openfire.SessionManager - Closing session with address test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427 and streamID tqik3vec1 does not have SM enabled.
2024.05.25 17:28:11.198 e[36mDEBUGe[m [socket_c2s-thread-2]: org.jivesoftware.openfire.spi.RoutingTableImpl - Adding client route test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427
2024.05.25 17:28:11.198 e[36mDEBUGe[m [socket_c2s-thread-2]: org.jivesoftware.openfire.spi.RoutingTableImpl - Adding client route ClientRoute{nodeID=c8417876-ae18-494a-a552-fcf5c4df0839, available=false} to users cache under key test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427
2024.05.25 17:28:11.199 e[36mDEBUGe[m [socket_c2s-thread-2]: org.jivesoftware.openfire.spi.PresenceManagerImpl - Recording 'last activity' for user 'test'.
2024.05.25 17:28:11.203 e[36mDEBUGe[m [socket_c2s-thread-2]: org.jivesoftware.openfire.spi.RoutingTableImpl - Removed users cache entry for test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427 / ClientRoute{nodeID=c8417876-ae18-494a-a552-fcf5c4df0839, available=false}, changing entry count from 1 to 0
2024.05.25 17:28:11.203 e[36mDEBUGe[m [socket_c2s-thread-2]: org.jivesoftware.openfire.spi.RoutingTableImpl - Removing client route test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427 from local routing table
2024.05.25 17:28:12.889 e[36mDEBUGe[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.SocketUtil - An exception occurred while trying to create a socket connection to XMPP domain 'local.com' using remote host local.com:5269
java.net.ConnectException: Connection refused
	at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
	at sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]
	at sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) ~[?:?]
	at sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?]
	at java.net.Socket.connect(Socket.java:633) ~[?:?]
	at org.jivesoftware.openfire.net.SocketUtil.createSocketToXmppDomain(SocketUtil.java:90) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.nio.NettySessionInitializer.init(NettySessionInitializer.java:100) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.createOutgoingSession(LocalOutgoingServerSession.java:262) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.authenticateDomain(LocalOutgoingServerSession.java:209) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.establishConnection(OutgoingSessionPromise.java:288) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(OutgoingSessionPromise.java:244) [xmppserver-4.8.1.jar:4.8.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2024.05.25 17:28:12.889 e[33mWARN e[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.SocketUtil - Unable to create a socket connection to XMPP domain 'local.com' using remote host: local.com:5269. Cause: Connection refused (a full stacktrace is logged on debug level)
2024.05.25 17:28:12.890 e[33mWARN e[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.net.SocketUtil - Unable to create a socket connection to XMPP domain 'local.com': Unable to connect to any of its remote hosts.
2024.05.25 17:28:12.890 e[33mWARN e[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.session.LocalOutgoingServerSession[Create outgoing session for: {local -> local.com}] - An exception occurred while creating a session. Closing connection.
java.lang.RuntimeException: Unable to create new session: Cannot create a plain socket connection with any applicable remote host.
	at org.jivesoftware.openfire.nio.NettySessionInitializer.init(NettySessionInitializer.java:103) ~[xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.createOutgoingSession(LocalOutgoingServerSession.java:262) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.session.LocalOutgoingServerSession.authenticateDomain(LocalOutgoingServerSession.java:209) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.establishConnection(OutgoingSessionPromise.java:288) [xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(OutgoingSessionPromise.java:244) [xmppserver-4.8.1.jar:4.8.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2024.05.25 17:28:12.894 e[33mWARN e[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.session.LocalOutgoingServerSession[Authenticate local domain: 'local' to remote domain: 'local.com'] - Unable to authenticate: Fail to create new session.
2024.05.25 17:28:12.895 e[33mWARN e[m [S2SOutgoingPromise-2]: org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor - An exception occurred while trying to establish a connection for {local -> local.com}
java.lang.Exception: Failed to create connection to remote server
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.establishConnection(OutgoingSessionPromise.java:301) ~[xmppserver-4.8.1.jar:4.8.1]
	at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(OutgoingSessionPromise.java:244) [xmppserver-4.8.1.jar:4.8.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
2024.05.25 17:28:12.896 e[36mDEBUGe[m [TaskEngine-pool-3]: org.jivesoftware.openfire.spi.RoutingTableImpl - Failed to route packet to JID: test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427 packet: <message to="test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427" from="woistdasniveau@local.com" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></message>
2024.05.25 17:28:12.897 e[36mDEBUGe[m [TaskEngine-pool-3]: org.jivesoftware.openfire.MessageRouter - Message sent to unreachable address: <message to="test@local/f95c1315-89a5-4b93-acd7-1d255ae2b427" from="woistdasniveau@local.com" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></message>

If it is useful i am running the server inside a docker container and i stated that all ports are forwared to the corresponding ports.

It seems that your server is identifying the domain that your user is trying to send the message as another server. did you set your server hostname the same way your client is connecting to the server?
because if you dont the server dont know its own name, so when the client tries to send a message the server try to find that server by the name.

1 Like

I just reject and it is set to local:
image

but local.com is not = Local right?

I was confused by that from the documentation, i thought i needed some ending like .com or anything but was unsure where this would come from.

Thank you, it worked, all makes more sense now. Can i change the server name somehow apart from setting it up again?

I recommend against changing the domain name of a running server, as that would be a change in the information used for addressing entities. If anything recorded an address of the ‘old’ name, that will go stale. Simply re-installing is safer.