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:
[0m[31m09: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" : "")); }
- is cloned by
-
JBEAP-24186 Server to Server EJB calls fail with ROOT deployments
- Closed