title: EJB Remote Invokation
body: <p>I'm having troubles invoking a remote EJB: first time I have to do that and I may be missing something. I've read many tutorials on the web, ad several answers here on <code>SO</code>but I can't solve. That's what I've done so far.</p>
  
  <p>My scenario is:</p>
  
  <p>I've got two <code>EAR</code>s deployed under <code>Wildfly 10.0.0.Final</code>: <code>server-ear</code> and <code>client-ear</code>.</p>
  
  <p>In <code>server-ear</code> I've got <code>server-api</code> and <code>server-ejb</code>, the first being a simple Java module containing my <code>EJB</code>s interfaces, the second being an <code>EJB</code> module containing the implementations.</p>
  
  <p>Those would be</p>
  
  <pre><code>@Remote
  public interface DummyApi {
      String getSomething();
  }
  </code></pre>
  
  <p>and its implementation</p>
  
  <pre><code>@Stateless
  @Remote(DummyApi.class)
  public class DummyApiImpl implements DummyApi {
      @Override
      public String getSomething() {
          return "SOMETHING";
      }
  }
  </code></pre>
  
  <p>In <code>client-ear</code> I've got a simple <code>EJB</code> module (<code>client-ejb</code>) that defines a singleton <code>EJB</code> which takes a reference to the <code>DummyApi</code> interface:</p>
  
  <pre><code>@javax.ejb.Singleton
  public class DummyClient {
  
      private static final Logger log = LoggerFactory.getLogger(DummyClient.class);
  
      private @EJB DummyApi dummyApi;
  
      @PostConstruct
      public void postConstruct() {
          log.debug("***** " + dummyApi.getSomething() + "******");
      }
  
  }
  </code></pre>
  
  <p>In <code>client-ejb</code> I also have placed the <code>jboss-ejb-client.properties</code> file under <code>src/main/resources</code></p>
  
  <pre><code>remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
  
  remote.connections=default
  
  remote.connection.default.host=localhost
  remote.connection.default.port = 8080
  remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
  </code></pre>
  
  <p>As for the interdependencies of those modules (I'm using Maven): </p>
  
  <pre><code>server-ear
    |---- server-api [compile]
    |---- server-ejb [compile]
            |-- server-api [provided]
  </code></pre>
  
  <p>and</p>
  
  <pre><code>client-ear
    |---- server-api [compile]
    |---- client-ejb [compile]
            |-- server-api [provided]
  </code></pre>
  
  <p>Both <code>EAR</code>s are dployed on the same local <code>Wildfly 10.0.0.Final</code> (clean installation of the server, no customizations whatsoever).When I start the server, I have no problems in <code>server-ear</code>.</p>
  
  <p><code>client-ear</code> instead fails with the following exception</p>
  
  <pre><code>12:05:22,592 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.subunit."client-ear-0.0.1-SNAPSHOT.ear"."client-ejb-0.0.1-SNAPSHOT.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."client-ear-0.0.1-SNAPSHOT.ear"."client-ejb-0.0.1-SNAPSHOT.jar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "client-ejb-0.0.1-SNAPSHOT.jar" of deployment "client-ear-0.0.1-SNAPSHOT.ear"
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0052: Failed to install component DummyClient
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:109)
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
      ... 5 more
  Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0406: No EJB found with interface of type 'com.server.api.DummyApi' for binding com.client.DummyClient/dummyApi
      at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:90)
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.processBindings(ComponentInstallProcessor.java:263)
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.access$000(ComponentInstallProcessor.java:80)
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor$1.handle(ComponentInstallProcessor.java:215)
      at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deployComponent(ComponentInstallProcessor.java:218)
      at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:101)
      ... 6 more
  </code></pre>
  
  <p>What am I missing or doing wrong?</p>