0 Replies Latest reply on Jan 30, 2020 10:05 AM by nhleroux

    Wildfly 10 to 18 upgrade issues with java client to remote EJB 2.0


      We are upgrading from Wildfly 10 to 18 and a java client application using the following imports will no longer compile due to the following classes not being found. What has replaced them in Wildfly 18?

      import org.jboss.ejb.client.ContextSelector;

      import org.jboss.ejb.client.EJBClientConfiguration;

      import org.jboss.ejb.client.PropertiesBasedEJBClientConfiguration;

      import org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector;


      Here is the method where they are used. Note the comment about a bug. Seems like it still exists? I've been reading the developers guide at Developer Guide , but am still a little lost about which option to use.


      private Context getInitialContext(String address, int port)

          throws NamingException {



      * NOTE: Before doing any change, read the following comment


      * In Wildfly there are two approaches to invoke a remote EJB: the old legacy way : remote-naming project and the

      * new way: EJB client API.

      * https://docs.jboss.org/author/display/WFLY8/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project


      * Due to a bug in wildfly (https://issues.jboss.org/browse/SECURITY-808) where authentication custom modules don't work such as: core-security

      * it was necessary to make some changes for the remote authentication realm from: ApplicationReal to a new one call acol-core-policy-realm (see: standalone-full.xml)


      *  <subsystem xmlns="urn:jboss:domain:remoting:3.0">


                  <http-connector name="http-remoting-connector" connector-ref="default" security-realm="acol-core-policy-realm"/>



      * By doing this changes and by using  EJB client API, it was possible to authenticate from a client to invoke an EJB in Wildfly.

      * Remote-naming project does not work when the default real is changed.

      * */


      Properties clientProp = new Properties();


      * These properties can be set in a file called: jboss-ejb-client.properties as it's found in many samples; however

      * the username, password and host change depending on the region, so we need to be able to change them dynamically.

      * */

          clientProp.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");

          clientProp.put("remote.connections", "default");

          clientProp.put("remote.connection.default.port", String.valueOf(port));

          clientProp.put("remote.connection.default.host", address);

          clientProp.put("remote.connection.default.username", _GLOBAL_CHANGE_USER_ID);

          clientProp.put("remote.connection.default.password", security.getProperty(_GLOBAL_CHANGE_USER_ID));

          clientProp.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");


          EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(clientProp);

          ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);



          Properties environment = new Properties();

          environment.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");


          return new javax.naming.InitialContext(environment);