javax.ejb.NoSuchEJBException: WFLYEJB0055: No matching deployment for EJB is thrown with EJB2 remote call

Solution Unverified - Updated -

Issue

A server to server remote EJB2 call will fail with WFLYEJB0055: No matching deployment for EJB in EAP 7.2.0.

Caused by: javax.ejb.NoSuchEJBException: WFLYEJB0055: No matching deployment for EJB: StatelessEJBLocator for "/ejb-server/EchoBean", view is interface org.example.ejb2.server.EchoRemote, affinity is Local
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:592)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
    at org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocationResult(RemotingEJBClientInterceptor.java:56)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
    at org.jboss.ejb.client.TransactionPostDiscoveryInterceptor.handleInvocationResult(TransactionPostDiscoveryInterceptor.java:133)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
    at org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocationResult(DiscoveryEJBClientInterceptor.java:115)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
    at org.jboss.ejb.client.NamingEJBClientInterceptor.handleInvocationResult(NamingEJBClientInterceptor.java:79)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
    at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:172)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
    at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
    at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:938)
    at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:177)
    at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:112)
    at com.sun.proxy.$Proxy30.greet(Unknown Source)
    at com.redhat.cee.example.servlet.HelloServlet.doGet(HelloServlet.java:32)
    ... 43 more

Application code to reproduce this issue is very simple as follows:

EJB2 client-side

Hashtable<String,String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
props.put(Context.PROVIDER_URL, "remote+http://localhost:8080");
InitialContext ctx = new InitialContext(props);
EchoBeanHome home = (EchoBeanHome) ctx.lookup("ejb:/ejb-server/EchoBean!org.example.ejb2.server.EchoBeanHome");
EchoRemote echo = home.create();
echo.greet("Shadowman");    // javax.ejb.NoSuchEJBException: WFLYEJB0055 is thrown from this line

EJB2 server-side

@Remote(EchoRemote.class)
@RemoteHome(EchoBeanHome.class)
@Stateless
public class EchoBean implements SessionBean {
    public String greet(String name) throws RemoteException {
        return "Hello, " + name;
    }
    // other methods is omitted
}

public interface EchoBeanHome extends EJBHome {
    public EchoRemote create() throws RemoteException, CreateException;
}

public interface EchoRemote extends EJBObject {
    public String greet(String name) throws RemoteException;
}

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.1
    • 7.2.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content