Uploaded image for project: 'XNIO'
  1. XNIO
  2. XNIO-422

Add information about remote connection address to the Exception when connection fails

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 3.8.11.Final
    • 3.8.9.Final
    • None
    • None

      When socket channel connection fails, the reported exception doesn't have any information about the attempted address.

      For example in Wildfly when trying to connect to a remote EJB with wrong remote address/IP produces:

      Caused by: jakarta.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "/jbeap14243-server-1.0.0/GreeterBean", view is interface Greeter, affinity is None
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:620)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:551)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocationResult(RemotingEJBClientInterceptor.java:57)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:622)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:551)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.TransactionPostDiscoveryInterceptor.handleInvocationResult(TransactionPostDiscoveryInterceptor.java:148)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:622)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:551)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocationResult(DiscoveryEJBClientInterceptor.java:130)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:622)
      	at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:551)
             ...
      	Suppressed: java.net.ConnectException: Connection refused
      		at java.base/sun.nio.ch.Net.pollConnect(Native Method)
      		at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:673)
      		at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)
      		at org.jboss.xnio.nio@3.8.9.Final-redhat-00001//org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:327)
      		at org.jboss.xnio.nio@3.8.9.Final-redhat-00001//org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
      		at ...asynchronous invocation...(Unknown Source)
      		at org.jboss.remoting@5.0.27.Final-redhat-00001//org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:600)
      		at org.jboss.remoting@5.0.27.Final-redhat-00001//org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:565)
      		at org.jboss.remoting@5.0.27.Final-redhat-00001//org.jboss.remoting3.ConnectionInfo$None.getConnection(ConnectionInfo.java:82)
      		at org.jboss.remoting@5.0.27.Final-redhat-00001//org.jboss.remoting3.ConnectionInfo.getConnection(ConnectionInfo.java:55)
      		at org.jboss.remoting@5.0.27.Final-redhat-00001//org.jboss.remoting3.EndpointImpl.doGetConnection(EndpointImpl.java:499)
      		at org.jboss.remoting@5.0.27.Final-redhat-00001//org.jboss.remoting3.EndpointImpl.getConnectedIdentity(EndpointImpl.java:445)
      		at org.jboss.remoting@5.0.27.Final-redhat-00001//org.jboss.remoting3.UncloseableEndpoint.getConnectedIdentity(UncloseableEndpoint.java:52)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider.getConnectedIdentityUsingClusterEffective(RemotingEJBDiscoveryProvider.java:342)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt.connectAndDiscover(RemotingEJBDiscoveryProvider.java:436)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider.discover(RemotingEJBDiscoveryProvider.java:170)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.protocol.remote.RemoteEJBDiscoveryConfigurator.lambda$configure$0(RemoteEJBDiscoveryConfigurator.java:42)
      		at org.wildfly.discovery@1.2.1.Final-redhat-00001//org.wildfly.discovery.impl.AggregateDiscoveryProvider.discover(AggregateDiscoveryProvider.java:58)
      		at org.wildfly.discovery@1.2.1.Final-redhat-00001//org.wildfly.discovery.Discovery.discover(Discovery.java:122)
      		at org.wildfly.discovery@1.2.1.Final-redhat-00001//org.wildfly.discovery.Discovery.discover(Discovery.java:93)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.DiscoveryEJBClientInterceptor.discover(DiscoveryEJBClientInterceptor.java:346)
      		at org.wildfly.common@1.6.0.Final-redhat-00001//org.wildfly.common.context.Contextual.runBiFunction(Contextual.java:224)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.DiscoveryEJBClientInterceptor.discover(DiscoveryEJBClientInterceptor.java:341)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.DiscoveryEJBClientInterceptor.doAnyDiscovery(DiscoveryEJBClientInterceptor.java:502)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.DiscoveryEJBClientInterceptor.executeDiscovery(DiscoveryEJBClientInterceptor.java:426)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocation(DiscoveryEJBClientInterceptor.java:110)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:514)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.NamingEJBClientInterceptor.handleInvocation(NamingEJBClientInterceptor.java:69)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:514)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.AuthenticationContextEJBClientInterceptor.lambda$handleInvocation$0(AuthenticationContextEJBClientInterceptor.java:45)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.AuthenticationContextEJBClientInterceptor.call(AuthenticationContextEJBClientInterceptor.java:59)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.AuthenticationContextEJBClientInterceptor.handleInvocation(AuthenticationContextEJBClientInterceptor.java:44)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:514)
      		at org.jboss.as.ejb3@8.0.0.GA-redhat-SNAPSHOT//org.jboss.as.ejb3.security.IdentityEJBClientInterceptor.lambda$handleInvocation$0(IdentityEJBClientInterceptor.java:48)
      		at org.wildfly.security.elytron-base@2.2.1.Final-redhat-00001//org.wildfly.security.auth.server.SecurityIdentity.runAsFunctionEx(SecurityIdentity.java:421)
      		at org.wildfly.security.elytron-base@2.2.1.Final-redhat-00001//org.wildfly.security.auth.server.Scoped.runAsFunctionEx(Scoped.java:161)
      		at org.wildfly.security.elytron-base@2.2.1.Final-redhat-00001//org.wildfly.security.auth.server.Scoped.runAsSupplierEx(Scoped.java:229)
      		at org.jboss.as.ejb3@8.0.0.GA-redhat-SNAPSHOT//org.jboss.as.ejb3.security.IdentityEJBClientInterceptor.handleInvocation(IdentityEJBClientInterceptor.java:47)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:514)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:205)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:514)
      		at org.wildfly.common@1.6.0.Final-redhat-00001//org.wildfly.common.context.Contextual.runExConsumer(Contextual.java:203)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBClientInvocationContext.sendRequestInitial(EJBClientInvocationContext.java:341)
      		at org.jboss.ejb-client@5.0.5.Final-redhat-00001//org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:178)
      		... 55 more
      

      Can we wrap the java.net.ConnectException in IOException with some additional information?

              spyrkob Bartosz Spyrko-Smietanko
              spyrkob Bartosz Spyrko-Smietanko
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: