Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-24186

Server to Server EJB calls fail with ROOT deployments

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Critical
    • None
    • 8.0.0.Beta-CR1
    • EJB, Remoting
    • None
    • False
    • None
    • False
    • Hide

      Use the attached reproducers:

      • reproducer-root.zip: this reproducer uses "root" deployments (i.e. ROOT.war deployments) and can be used to show the error
      • reproducer-no-root.zip: this reproducer uses non "root" deployments (e.g. tx-client.war and tx-server.war deployments) and can be used to show that with non "root" deployments we don't have the error
      • reproducer-7.4.x.zip: this reproducer uses "root" deployments (i.e. ROOT.war deployments) and can be used to show the error with EAP 7.4

      For both the reproducers the steps are the same:

      unzip reproducer-root.zip
      

      In a new shell start server B:

      ./start-server.sh <PATH_TO_EAP_ZIP>
      

      In a new shell start server A:

      ./start-client.sh <PATH_TO_EAP_ZIP>
      

      In a new shell invoke the REST endpoints:

      ./test.sh
      

      Inspect the server logs

      Show
      Use the attached reproducers: reproducer-root.zip : this reproducer uses "root" deployments (i.e. ROOT.war deployments) and can be used to show the error reproducer-no-root.zip : this reproducer uses non "root" deployments (e.g. tx-client.war and tx-server.war deployments) and can be used to show that with non "root" deployments we don't have the error reproducer-7.4.x.zip : this reproducer uses "root" deployments (i.e. ROOT.war deployments) and can be used to show the error with EAP 7.4 For both the reproducers the steps are the same: unzip reproducer-root.zip In a new shell start server B: ./start-server.sh <PATH_TO_EAP_ZIP> In a new shell start server A: ./start-client.sh <PATH_TO_EAP_ZIP> In a new shell invoke the REST endpoints: ./test.sh Inspect the server logs

    Description

      We have two EAP servers: server A and server B;

      On server A we deploy an application which exposes some REST endpoints;
      On server B we deploy an application which exposes some remote EJBs;
      When the REST endpoints on server A are invoked, server A tries and invokes a remote EJB on server B;

                       Server A             Server B
                   ┌─────────────────┐     ┌────────┐
                   │                 │     │        │
      HTTP call-----> REST---> EJB ----------> EJB  │
                   │                 │     │        │
                   └─────────────────┘     └────────┘
      

      When the deployments on server A and server B are "root" deployments (ROOT.war) the remote invocation fails with the following error:

          09:00:29,438 ERROR [org.jboss.as.ejb3.invocation] (default task-1) WFLYEJB0034: Jakarta Enterprise Beans Invocation failed on component BasicClientStateless for method public java.lang.String org.jboss.as.quickstarts.xa.client.BasicClientStateless.passTxStatelessStateless(org.jboss.as.quickstarts.xa.client.LookupHelper$LookupType): jakarta.ejb.EJBException: java.lang.RuntimeException: jakarta.ejb.NoSuchEJBException: WFLYEJB0056: Could not find Jakarta Enterprise Beans in matching deployment: StatelessEJBLocator for "/ROOT/BasicServerStateless1", view is interface org.jboss.as.quickstarts.xa.server.BasicServerRemote1, affinity is None
              at org.jboss.as.ejb3@8.0.0.Beta-redhat-00003//org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:268)
          

      See the attached file tx-client-0-tx-client(11).log for complete log;

      The error happens only when using server configuration for remote look-up (see method lookupRemoteEJBOutbound i n class LookupHelper in the reproducers):

      private static <T> T lookupRemoteEJBOutbound(String beanImplName, Class<T> remoteInterface, boolean isStateful, Properties ejbProperties) throws NamingException {
              final Properties jndiProperties = new Properties();
              if (ejbProperties != null) jndiProperties.putAll(ejbProperties);
              jndiProperties.put(Context.URL_PKG_PREFIXES, JNDI_PKG_PREFIXES);
              final Context context = new InitialContext(jndiProperties);
      
              String lookupEjbStr = "ejb:/" + REMOTE_DEPLOYMENT_NAME + "/" + beanImplName + "!"
                      + remoteInterface.getName() + (isStateful ? "?stateful" : "");
              log.info("[LOOKUP] EJB lookup string: " + lookupEjbStr);
      
              return (T) context.lookup(lookupEjbStr);
          }
      

      the server configuration is:

      batch
      /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=remote-ejb:add(host=127.0.0.1, port=8080)
      /subsystem=remoting/remote-outbound-connection=remote-ejb-connection:add(outbound-socket-binding-ref=remote-ejb, username=ejb, protocol=http-remoting)
      /subsystem=remoting/remote-outbound-connection=remote-ejb-connection/property=SASL_POLICY_NOANONYMOUS:add(value=false)
      /subsystem=remoting/remote-outbound-connection=remote-ejb-connection/property=SSL_ENABLED:add(value=false)
      /subsystem=elytron/authentication-configuration=ejb-auth:add(authentication-name="ejb", credential-reference={clear-text="ejb"})
      /subsystem=elytron/authentication-context=default:add(match-rules=[{authentication-configuration=ejb-auth}])
      /subsystem=elytron:write-attribute(name=default-authentication-context,value=default)
      run-batch
      

      the client jboss-ejb-client.xml file is:

      <?xml version='1.0' encoding='UTF-8'?>
      <jboss-ejb-client xmlns:xsi="urn:jboss:ejb-client:1.2" xsi:noNamespaceSchemaLocation="jboss-ejb-client_1_2.xsd">
        <client-context>
            <ejb-receivers>
                <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection"/>
                <!--<remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection2"/>-->
            </ejb-receivers>
        </client-context>
      </jboss-ejb-client>
      

      There is no error with direct invocation (see method lookupRemoteEJBDirect in class LookupHelper in the reproducers):

      private static <T> T lookupRemoteEJBDirect(String beanImplName, Class<T> remoteInterface, boolean isStateful, Properties ejbProperties) throws NamingException {
      
              Properties jndiProperties = new Properties();
              jndiProperties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
              String remoteServerHost = System.getProperty("tx.server.host", "tx-server"); 
              log.info("[LOOKUP] tx.server.host=" + remoteServerHost);
              jndiProperties.put(javax.naming.Context.PROVIDER_URL, "remote+http://" + remoteServerHost + ":8080");
              jndiProperties.put(Context.URL_PKG_PREFIXES, JNDI_PKG_PREFIXES);        jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
              jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SSL_STARTTLS", "false");
              jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SSL_ENABLED", "false");
              jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "true");
              jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER");
              jndiProperties.put(Context.SECURITY_PRINCIPAL, "ejb");
              jndiProperties.put(Context.SECURITY_CREDENTIALS, "ejb");
      
              if (ejbProperties != null) jndiProperties.putAll(ejbProperties);
      
              final Context context = new InitialContext(jndiProperties);
      
              return (T) context.lookup("ejb:/" + REMOTE_DEPLOYMENT_NAME + "/" + beanImplName + "!"
                      + remoteInterface.getName() + (isStateful ? "?stateful" : ""));
          }
      

      Attachments

        1. reproducer-7.4.x.zip
          46 kB
        2. reproducer-no-root.zip
          48 kB
        3. reproducer-root.zip
          48 kB
        4. tx-client-0-tx-client(11).log
          265 kB

        Issue Links

          Activity

            People

              cfang@redhat.com Cheng Fang
              tborgato@redhat.com Tommaso Borgato
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: