3 Replies Latest reply on Oct 23, 2018 5:12 AM by nebeleben

    EJB Client behind HTTP Proxy unable to connect to Wildfly 12

    nebeleben

      We are trying to establish a connection between our EJB client and Wildfly 12 over HTTP with SLL on port 8444 using the wildfly-http-client lib. The connections is working fine as long as the client is not behind a proxy.

      for proxy we use the property:

      http.proxyHost
      http.proxyPort
      http.proxyHost
      java.net.useSystemProxies

      When turing on the proxy on (port 8080), the EJB Client is no longer able to connect to the wildfly server (internet). Lookup a service on the InitialContext ends in a java.net.UnknownHostException.

      Establishing a connection using apache commons works just fine.

      Is it possible at all for an EJB client behind a proxy to connect to Wildfly 12?

      Any help is appreciated. Also just to find the answer to the basic question if an EJB client connection to Wildfly 12 is possible, when the client is located behind a proxy.

      Thanks

        • 1. Re: EJB Client behind HTTP Proxy unable to connect to Wildfly 12
          jewellgm

          I don't know whether you are using those exact properties listed above, or if they are a simple copy/paste error, but there is no "http.proxyProxyPort" or "https.proxyProxyPort" property.  They should be "http.proxyPort" and "https.proxyPort", respectively.

           

          Normally, if you set "java.net.useSystemProxies" to "true", Java will use the global proxy settings of the OS.  Setting the other properties overrides this though.  I don't know what happens if you override the "proxyHost" property, but don't override the "proxyPort" property.  Based on your original post, it is possible that you are doing this.

           

          Another thing to consider is whether the client is on the same network as the server.  If it is, you'll typically want to bypass the proxy.  You can do that by setting the "http.nonProxyHosts" property.  There is no "https" version of that property -- the "http" version applies to both protocols.  The values of this property are delimited with the "|" character, and may contain wildcard values.

          • 2. Re: EJB Client behind HTTP Proxy unable to connect to Wildfly 12
            nebeleben

            Yes there was a copy/paste error in the listed properties. I corrected it.

             

            As already mentioned our connection trough a proxy server works just fine when connecting to the apache on port 8080, so the used proxy settings are correct.

             

            What does not work, is the connection for the EJB Client using the wildfly-naming-client lib, which does work when not using a proxy

             

            AuthenticationContext authContext = AuthenticationContext.empty().with(MatchRule.ALL.matchHost(config.getHost()), authConfig);

            Callable<Void> callable = () -> {

              Properties properties = new Properties();
               properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
               properties.put(SCOPED_CONTEXT, true);
               properties.put(Context.SECURITY_PRINCIPAL, user);
               properties.put(Context.SECURITY_CREDENTIALS, password);
               String address = config.getProtocol() + "://" + config.getHost() + ":" + config.getPort();

              if (config.getEjbOverHttp()) {

              address = address + HTTP_SERVICES;
               }

              

              properties.put(Context.PROVIDER_URL, address);
               context = (Context) new InitialContext(properties).lookup("ejb:");

            };

            authContext.runCallable(callable);

            • 3. Re: EJB Client behind HTTP Proxy unable to connect to Wildfly 12
              nebeleben

              So in our opinion the Wildfly 12 stack does not support connection from EJB Client to server trough a forward proxy.

               

              Therefor we are planning to offer our EJB services as well as Web Services trough javax-ws and adapt our datamodel so it will be possible to marshall/unmarshall with JAXB.

              Seems to be quite a lot of work but at least this will work as well when a proxy is involved in client/server communication.