1 Reply Latest reply on Sep 17, 2019 4:29 PM by Greg Jewell

    HTTP proxy support for EJB clients

    sachin patel Newbie

      I am trying to establish a connection between my EJB client and Wildfly17 over HTTP on port 8080. The connection is established and I can send/receive messages.

      However, When I am trying to establish a connection from EJB client via HTTP proxy server to Wildfly, Requests are not routing through Proxy server instead it is creating a direct connection to Wildfly.

      I am using below system properties to provide proxy support for EJB clients (Apart from wildfly, all other http requests are routing through proxy server with same configuration)

      System.setProperty("java.net.useSystemProxies", "true");

      System.setProperty("http.proxyHost", proxyhost);

      System.setProperty("http.proxyPort", proxyport);

      Authenticator.setDefault(new Authenticator() {

         @Override
         public PasswordAuthentication getPasswordAuthentication() {

         return new PasswordAuthentication("user","pass".toCharArray() );

       

        }

      } );

      System.setProperty("http.proxyUser",user);

      System.setProperty("http.proxyPassword",pass);

       

       

      For the connection, I am using

      URL : "http-remoting://host:port"

      Connection Factory: "jms/RemoteConnectionFactory"

      Context Factory: "org.jboss.naming.remote.client.InitialContextFactory"

       

       

      Is there any way by which I can connect my EJB client to Wildfly via Proxy?

        • 1. Re: HTTP proxy support for EJB clients
          Greg Jewell Expert

          I'm not certain why this would matter for proxy configurations, but you may want to try changing your initial context factory and protocol values.  These were deprecated and replaced.  The preferred values now are:

           

          Initial Context Factory:  org.wildfly.naming.client.WildFlyInitialContextFactory

          URL: "remote+http://host:port"

           

          Since the proxy settings are Java system values, it doesn't seem like it should matter -- the underlying connection should pick up on the Java system settings.  It's worth a shot, though.

           

          Application Client Migration - Latest WildFly Documentation - Project Documentation Editor

           

          Edit: I also just noticed that you are using both the setting to use system proxies (as configured in internet explorer), and also trying to manually set the proxy values.  I don't know which takes precedence.  Have you tried to remove the "java.net.useSystemProxies" property, or setting it to false?