title: javax.ejb.NoSuchEJBException: EJBCLIENT000079 with JBoss 7.1 and Eclipse
body: <p>I am quite new to JavaEE and tried to get a little Hello World example running (<a href="https://ibytecode.com/blog/how-to-create-a-simple-ejb3-project-in-eclipse-jboss-7-1/" rel="nofollow noreferrer">https://ibytecode.com/blog/how-to-create-a-simple-ejb3-project-in-eclipse-jboss-7-1/</a>), but I am stuck with an </p>
  
  <pre><code>Exception in thread "main" javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "/HelloWorldSessionBean/HelloWorldBean", view is interface com.ibytecode.business.HelloWorld, affinity is None
  </code></pre>
  
  <p>It is probably only some beginner's error, but I am lost here.</p>
  
  <p>Here is my source code:</p>
  
  <p>HelloWorld.java</p>
  
  <pre><code>package com.ibytecode.business;
  import javax.ejb.Remote;
  
  @Remote
  public interface HelloWorld {
      public String sayHello();
  }
  </code></pre>
  
  <p>HelloWorldBean.java</p>
  
  <pre><code>package com.ibytecode.businesslogic;
  import com.ibytecode.business.HelloWorld;
  import javax.ejb.Stateless;
  
  /**
   * Session Bean implementation class HelloWorldBean
   */
  @Stateless
  public class HelloWorldBean implements HelloWorld {
  
      public HelloWorldBean() {
      }
  
      @Override
      public String sayHello() {
          return "Hello World !!!";
      }
  
  }
  </code></pre>
  
  <p>I created a JBoss 7.1 Server in Eclipse, started and deployed the <code>HelloWorldSessionBean</code>. That seemed to work well:</p>
  
  <pre><code>...
  10:23:17,999 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-8) WFLYEJB0473: JNDI bindings for session bean named 'HelloWorldBean' in deployment unit 'deployment "HelloWorldSessionBean.jar"' are as follows:
  
      java:global/HelloWorldSessionBean/HelloWorldBean!com.ibytecode.business.HelloWorld
      java:app/HelloWorldSessionBean/HelloWorldBean!com.ibytecode.business.HelloWorld
      java:module/HelloWorldBean!com.ibytecode.business.HelloWorld
      java:jboss/exported/HelloWorldSessionBean/HelloWorldBean!com.ibytecode.business.HelloWorld
      java:global/HelloWorldSessionBean/HelloWorldBean
      java:app/HelloWorldSessionBean/HelloWorldBean
      java:module/HelloWorldBean
  ...
  </code></pre>
  
  <p>Here's the client code:</p>
  
  <pre><code>package com.ibytecode.client;
  
  import java.util.Properties;
  
  import javax.naming.Context;
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  
  import com.ibytecode.business.HelloWorld;
  
  public class EJBApplicationClient {
  
      public static void main(String[] args) {
          InitialContext context = null;
          HelloWorld bean = null;
          try {
              Properties properties = new Properties();
              properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
              //properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
              properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
              context = new InitialContext(properties);
  
              String lookupName = "ejb:/HelloWorldSessionBean/HelloWorldBean!com.ibytecode.business.HelloWorld";
              bean = (HelloWorld) context.lookup(lookupName);
  
          } catch (NamingException e) {
              e.printStackTrace();
          }
          System.out.println(bean.sayHello());
      }
  }
  </code></pre>
  
  <p>And I put <code>jboss-ejb-client.properties</code> in the class path:</p>
  
  <pre><code>endpoint.name=client-endpoint
  remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
  
  remote.connections=default
  
  remote.connection.default.host=localhost
  remote.connection.default.port = 4447
  remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
  
  remote.connection.default.username=admin
  remote.connection.default.password=admin
  </code></pre>
  
  <p>When I run the client as plain Java application, I get this output:</p>
  
  <pre><code>Mär 07, 2019 2:35:57 PM org.wildfly.naming.client.Version &lt;clinit&gt;
  INFO: WildFly Naming version 1.0.7.Final-redhat-1
  Mär 07, 2019 2:35:57 PM org.wildfly.security.Version &lt;clinit&gt;
  INFO: ELY00001: WildFly Elytron version 1.1.7.Final-redhat-1
  Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.naming.ejb.ejbURLContextFactory &lt;clinit&gt;
  INFO: EJBCLIENT000064: org.jboss.ejb.client.naming.ejb.ejbURLContextFactory is deprecated; new applications should use org.wildfly.naming.client.WildFlyInitialContextFactory instead
  Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.EJBClient &lt;clinit&gt;
  INFO: JBoss EJB Client version 4.0.9.Final-redhat-1
  Mär 07, 2019 2:35:57 PM org.jboss.naming.remote.client.InitialContextFactory &lt;clinit&gt;
  INFO: WFNAM00025: org.jboss.naming.remote.client.InitialContextFactory is deprecated; new applications should use org.wildfly.naming.client.WildFlyInitialContextFactory instead
  Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.legacy.LegacyPropertiesConfiguration configure
  INFO: EJBCLIENT000072: Using legacy jboss-ejb-client.properties EJB client configuration
  Mär 07, 2019 2:35:57 PM org.xnio.Xnio &lt;clinit&gt;
  INFO: XNIO version 3.5.4.Final-redhat-1
  Mär 07, 2019 2:35:57 PM org.xnio.nio.NioXnio &lt;clinit&gt;
  INFO: XNIO NIO Implementation Version 3.5.4.Final-redhat-1
  Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.legacy.RemotingLegacyConfiguration getConfiguredEndpoint
  INFO: EJBCLIENT000070: Using legacy jboss-ejb-client.properties Remoting configuration
  Mär 07, 2019 2:35:57 PM org.jboss.remoting3.EndpointImpl &lt;clinit&gt;
  INFO: JBoss Remoting version 5.0.5.Final-redhat-1
  Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.legacy.ElytronLegacyConfiguration getConfiguredAuthenticationContext
  INFO: EJBCLIENT000069: Using legacy jboss-ejb-client.properties security configuration
  Exception in thread "main" javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "/HelloWorldSessionBean/HelloWorldBean", view is interface com.ibytecode.business.HelloWorld, affinity is None
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:567)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
      at org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocationResult(RemotingEJBClientInterceptor.java:56)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
      at org.jboss.ejb.client.TransactionPostDiscoveryInterceptor.handleInvocationResult(TransactionPostDiscoveryInterceptor.java:133)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
      at org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocationResult(DiscoveryEJBClientInterceptor.java:108)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
      at org.jboss.ejb.client.NamingEJBClientInterceptor.handleInvocationResult(NamingEJBClientInterceptor.java:78)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
      at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:172)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
      at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
      at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:913)
      at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:177)
      at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:112)
      at com.sun.proxy.$Proxy0.sayHello(Unknown Source)
      at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:53)
      Suppressed: java.net.ConnectException: Connection refused: no further information
          at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
          at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
          at org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:327)
          at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
          at ...asynchronous invocation...(Unknown Source)
          at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:570)
          at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:536)
          at org.jboss.remoting3.ConnectionInfo$None.getConnection(ConnectionInfo.java:82)
          at org.jboss.remoting3.ConnectionInfo.getConnection(ConnectionInfo.java:55)
          at org.jboss.remoting3.EndpointImpl.doGetConnection(EndpointImpl.java:487)
          at org.jboss.remoting3.EndpointImpl.getConnectedIdentity(EndpointImpl.java:433)
          at org.jboss.remoting3.Endpoint.getConnectedIdentity(Endpoint.java:122)
          at org.jboss.remoting3.Endpoint.getConnectedIdentity(Endpoint.java:135)
          at org.jboss.remoting3.Endpoint.getConnection(Endpoint.java:212)
          at org.jboss.ejb.client.legacy.RemotingLegacyConfiguration.getConfiguredEndpoint(RemotingLegacyConfiguration.java:81)
          at org.jboss.remoting3.ConfigurationEndpointSupplier$Holder.lambda$static$0(ConfigurationEndpointSupplier.java:58)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.jboss.remoting3.ConfigurationEndpointSupplier$Holder.&lt;clinit&gt;(ConfigurationEndpointSupplier.java:45)
          at org.jboss.remoting3.ConfigurationEndpointSupplier.get(ConfigurationEndpointSupplier.java:84)
          at org.jboss.remoting3.ConfigurationEndpointSupplier.get(ConfigurationEndpointSupplier.java:40)
          at org.wildfly.common.context.ContextManager.getPrivileged(ContextManager.java:282)
          at org.jboss.remoting3.Endpoint.getCurrent(Endpoint.java:80)
          at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider.&lt;init&gt;(RemotingEJBDiscoveryProvider.java:92)
          at org.jboss.ejb.protocol.remote.RemoteTransportProvider.notifyRegistered(RemoteTransportProvider.java:43)
          at org.jboss.ejb.client.EJBClientContext.&lt;init&gt;(EJBClientContext.java:275)
          at org.jboss.ejb.client.EJBClientContext$Builder.build(EJBClientContext.java:788)
          at org.jboss.ejb.client.ConfigurationBasedEJBClientContextSelector.loadConfiguration(ConfigurationBasedEJBClientContextSelector.java:71)
          at org.jboss.ejb.client.ConfigurationBasedEJBClientContextSelector.&lt;clinit&gt;(ConfigurationBasedEJBClientContextSelector.java:52)
          at org.jboss.ejb.client.EJBClientContext.getDefault(EJBClientContext.java:109)
          at org.wildfly.common.context.ContextManager.getPrivileged(ContextManager.java:282)
          at org.jboss.ejb.client.EJBClientContext.getCurrent(EJBClientContext.java:798)
          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:161)
          ... 3 more
      Suppressed: java.net.ConnectException: Connection refused: no further information
          at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
          at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
          at org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:327)
          at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
          at ...asynchronous invocation...(Unknown Source)
          at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:570)
          at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:536)
          at org.jboss.remoting3.ConnectionInfo$None.getConnection(ConnectionInfo.java:82)
          at org.jboss.remoting3.ConnectionInfo.getConnection(ConnectionInfo.java:55)
          at org.jboss.remoting3.EndpointImpl.doGetConnection(EndpointImpl.java:487)
          at org.jboss.remoting3.EndpointImpl.getConnectedIdentity(EndpointImpl.java:433)
          at org.jboss.remoting3.UncloseableEndpoint.getConnectedIdentity(UncloseableEndpoint.java:51)
          at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider.getConnectedIdentityUsingClusterEffective(RemotingEJBDiscoveryProvider.java:311)
          at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt.lambda$connectAndDiscover$0(RemotingEJBDiscoveryProvider.java:384)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt.connectAndDiscover(RemotingEJBDiscoveryProvider.java:384)
          at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt.countDown(RemotingEJBDiscoveryProvider.java:468)
          at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt$1.handleFailed(RemotingEJBDiscoveryProvider.java:350)
          at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt$1.handleFailed(RemotingEJBDiscoveryProvider.java:342)
          at org.xnio.IoFuture$HandlingNotifier.notify(IoFuture.java:215)
          at org.xnio.AbstractIoFuture$NotifierRunnable.run(AbstractIoFuture.java:720)
          at org.jboss.remoting3.EndpointImpl$TrackingExecutor.lambda$execute$0(EndpointImpl.java:926)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>I put the <code>jboss-client.jar</code> from <code>$JBOSS-HOME/bin/client</code> in the classpath.</p>
  
  <p>Any suggestions what I did wrong?
  Thanks a lot!</p>
  
  <p>Edit: Probably, it's worth noting that the NoSuchEJBException occurs because of <code>bean.sayHello()</code>. So, maybe it's not a problem with the lookup, but with the connection?</p>