0 Replies Latest reply on Jul 30, 2018 3:16 AM by sergiu_pienar

    Wildfly13 to WildFly13 remote ejb call only works intermittently

    sergiu_pienar

      I have a class, deployed inside a jar, packed in an EAR, deployed to a WildFly 13 instance.

      From this class, I'm remoting calling a secured bean on another WildFly 13 instance.

       

      The client code:

       

      // create your authentication configuration
      AuthenticationConfiguration ejbConfig = AuthenticationConfiguration.empty()
      .setSaslMechanismSelector(SaslMechanismSelector.NONE.addMechanism("PLAIN")).useRealm("myRealm").useName(username)
      .usePassword(password);
      // create your authentication context
      AuthenticationContext context = AuthenticationContext.empty().with(MatchRule.ALL, ejbConfig);
      AuthenticationContext.getContextManager().setThreadDefault(context);
      // create an InitialContext
      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
      properties.put(Context.PROVIDER_URL, "remote+http://" + host + ":" + port);
      InitialContext ctx = new InitialContext(properties);
      // look up an EJB and invoke one of its methods (same as before)
      CustomCodeRemote remoteEjb = (CustomCodeRemote)ctx
      .lookup("ejb:acme-all-5.4.1.4/acme-all-ejbs/CustomCodeBean!com.business.customcode.CustomCodeRemote");
      List results = remoteEjb.queryByClientAndJarName(-1L, "acme-dhelpers.jar");
      System.out.println(results);

       

      The outbound socket:

       

      <outbound-socket-binding name="ejb-outbound">

      <remote-destination host="192.168.0.105" port="8080"/>

      </outbound-socket-binding>

       

      Remoting subsystem:

       

      <subsystem xmlns="urn:jboss:domain:remoting:4.0">

      <http-connector name="http-remoting-connector" connector-ref="default" security-realm="myRealm" sasl-authentication-factory="elytron-sasl-authentication">

      <sasl/>

      </http-connector>

      <outbound-connections> 

      <remote-outbound-connection name="ejb-outbound-connection" outbound-socket-binding-ref="ejb-outbound" authentication-context="ejb-outbound-context"/> 

      </outbound-connections>

      </subsystem>

       

      Authentication client defined within the elytron subsystem:

       

      <authentication-client> 

      <authentication-configuration name="ejb-outbound-configuration" security-domain="myElytronDomain" sasl-mechanism-selector="PLAIN"/> 

      <authentication-context name="ejb-outbound-context"> 

      <match-rule authentication-configuration="ejb-outbound-configuration"/> 

      </authentication-context> 

      </authentication-client>

       

      The Elytron domain is fine, I'm using it for securing the web-app deployed in the EAR, and also for calling the EJBs from a standalone client.

       

      The problem is that the server to server call only works intermittently.

       

      Any ideas ?